Jakson Alves de Aquino
José Cláudio Faria
This plugin improves Vim's support to edit R code.
Download the plugin:
http://www.vim.org/scripts/script.php?script_id=2628
If you use Debian or a Debian based Linux distribution (Ubuntu or other), you may want to install the vim-r-plugin_0.9.9.3-1_all.deb package. After the installation, you can enable the plugin by doing the following commands:
vim-addons remove r-plugin vim-addons install r-plugin
Notes:
Please, read the plugin's documentation for details on usage.
Sample vimrc:
set nocompatible syntax on filetype plugin on filetype indent on "------------------------------------ " Behavior "------------------------------------ let maplocalleader = "," let mapleader = ";" "------------------------------------ " Appearance "------------------------------------ colorscheme southernlights "------------------------------------ " Showmarks "------------------------------------ let marksCloseWhenSelected = 0 let showmarks_include="abcdefghijklmnopqrstuvwxyz" "------------------------------------ " Vim-R-plugin "------------------------------------ let vimrplugin_objbr_place = "console,right" if $DISPLAY != "" let vimrplugin_openpdf = 1 let vimrplugin_openhtml = 1 endif if has("gui_running") inoremap <C-Space> <C-x><C-o> else inoremap <Nul> <C-x><C-o> endif vmap <Space> <Plug>RDSendSelection nmap <Space> <Plug>RDSendLine |
Videos on youtube:
Screenshots:
The plugin running in a terminal emulator, using the screen.vim plugin and the Tmux application to split the terminal in two regions separated by a green line. Vim is running in one region and R in the other. We are using Vim's omni completion feature to complete "read.s". The scratch window at the top shows the arguments of read.spss(). The operating system is Linux:
The Vim window was split in two. At the right side the object browser shows the loaded libraries and we can see the objects of the library foreign.
Now, the the object browser shows the objects that are in R's workspace:

R documentation for the function attr() is shown in a separate tab:

Syntax highlight of R code. The output is being colorized by the R package colorout:

In this screenshot, we can also see the use of the ShowMarks plugin to highlight marks. In the example, we are repeatedly changing the legend's coordinates and sending the block of code between the marks 'a' and 'b' to find the best position of the legends:

The plugin on Windows. The option r_syntax_folding was set in the vimrc to enable folding by syntax and the function makeMap() is folded:

Last change: Apr. 2013