Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Evaluate R ( code from GVIM via rcom, rserve, screen, or tmux
VimL R
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


The rcom ftplugin uses one of the following methods to evaluate R code:

    screen ........ default method; works under Linux & Windows (with 
                    cygwin/mintty & Windows Rterm)
    screen/tmux ... via the screen vim plugin; works under Linux & 
    RServe ........ requires +ruby and the rserve-client rubygem; works 
                    under Linux & (less reliably) under Windows
    RCOM .......... requires; works under 

With the exception of RCOM, most methods should work also under Mac OS 
but that was not tested.

After installation, interaction with R is enabled for all
buffers with filetype r. For other filetypes, you can use the
functions |rcom#EvaluateInBuffer()|.


    - Evaluate R code
    - Operator map
    - Maps for normal, visual, and insert mode
    - Keyword map (|K|)
    - Inspect & edit/fix object (<LocalLeader>K)
    - Debug function

The following features are supported only with some methods:

    - Omnicompletion for R
    - Get return values from R

Why use this plugin instead of r-plugin? It's hopefully easier to install, 
easier to use.


For the RCOM and rserve methods, it is recommended to set 
|g:rcom#server|. Depending on your OS, your version of ruby & R & 
rcom/rserve, this ftplugin may cause vim to hang or crash. When you run 
the R code via a second instance of GVIM, you won't suffer from such 
hickups. This also has the side effect that you can continue editing 
while R evaluates the code.

For the RCOM method, it is recommended to set |g:rcom#reuse| = 1 and to 
start an instance of RGui (Windows only) before initiating any 
communication via RCOM. 


The ftplugin provides several maps (see also |g:rcom_map|, 
|g:rcom_mapp|) to evaluate R code and optionally print the result in 
normal, insert, and visual mode. There is also an operator (see 

Default Maps:
    <c-cr>    ... Evaluate the current line
    <c-s-cr>  ... Evaluate the current line & print result
    +.        ... Evaluate the current line (normal mode)
    +{motion} ... Operator
    [visual]+ ... Evaluate the visual area
    +p        ... Toggle printing for the above maps
    +d        ... Toggle a function's debug status
    +s        ... Source the current buffer in R
    +t        ... Show the transcript buffer
    +l        ... Open the log window
    ++        ... Evaluate the |maparg| previously mapped to #
    K         ... Info on the word under cursor
    <LocalLeader>K ... Inspect/edit/fix the object under cursor

Normal usage~

    0.  Optional steps:
            a. Prepare a running instance of RGui if using the RCOM 
            b. RCOM and screen methods: The results get printed in the R 
               window. You might want to arrange the windows in a way, 
               so that you can see VIM, R console and R graphic device 
               at the same time.
    1.  Open an R source file in VIM.
    2a. Type <c-cr> to evaluate the current line/visual area in R.
    2b. Type [count]+ or +{motion} to evaluate some text in R. (You can 
        type ++ to invoke |+|.)


Status:  Works for me (there may be some minor quirks)
Install: See
See for related plugins.

Something went wrong with that request. Please try again.