Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Evaluate R (www.r-project.org) 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.
autoload
doc
etc
ftplugin/r
templator
.gitignore
CHANGES.TXT
README
addon-info.json

README

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 & 
                    Windows
    RServe ........ requires +ruby and the rserve-client rubygem; works 
                    under Linux & (less reliably) under Windows
    RCOM .......... requires http://rcom.univie.ac.at; works under 
                    Windows

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()|.

Features:

    - 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.


Caveats:

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. 


Maps~

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 
|g:rcom_mapop|).

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 
               method.
            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 http://github.com/tomtom/vimtlib/blob/master/INSTALL.TXT
See http://github.com/tomtom for related plugins.

Something went wrong with that request. Please try again.