## R-PLUGIN

*r-plugin.txt*                                                      *vim-r-plugin*
				 Vim-R-plugin
			     Plugin to work with R

Authors: Jakson A. Aquino
Jose Claudio Faria

Version: 1.0
For Vim version 7.4

1. Overview                                    r-plugin-overview
2. Main features                               r-plugin-features
3. Installation                                r-plugin-installation
4. Use                                         r-plugin-use
5. Known bugs and workarounds                  r-plugin-known-bugs
6. Options                                     r-plugin-options
7. Custom key bindings                         r-plugin-key-bindings
9. FAQ and tips                                r-plugin-tips
10. News                                        r-plugin-news

--------------------------------------------------------
*r-plugin-overview*
1. Overview

This plugin improves Vim's support for editing R code and makes it possible to
integrate Vim with R.

It uses some ideas and code from Johannes Ranke's (vim-r-plugin), Eric Van
Dewoestine's (screen.vim plugin), Vincent Nijs (R.vim for Mac OS X) and some
ideas from the Tinn-R (Windows only) project.

The latest stable version of this plugin is available at:

http://www.vim.org/scripts/script.php?script_id=2628

Feedback is welcomed. Please submit bug reports to the developers. Do not like
a feature? Tell us and we may add an option to disable it. If you have any

The plugin should emit useful warnings if you do things it was not programmed
to deal with. Cryptic error message are bugs... Please report them at:

https://github.com/jcfaria/Vim-R-plugin/issues

We do not plan to take the initiative of writing code for new features, but
patches and git pull requests are welcome. If you want a feature that only few
people might be interested in, you can write a script to be sourced by the
Vim-R-plugin (see vimrplugin_source).

--------------------------------------------------------
*r-plugin-features*
2. Main features

* Syntax highlighting for R code, including:
- Special characters in strings.
- Special highlighting for R output (.Rout files).
- Spell check only strings and comments.
- Fold code when foldmethod=syntax.
* Syntax highlighting for RHelp, RMarkdown and RreStructuredText.
* Smart indentation for R, RHelp, Rnoweb, RMarkdown and RreStructuredText.
* Integrated communication with R:
- Start/Close R.
- Send lines, selection, paragraphs, functions, blocks, entire file.
- Send commands with the object under cursor as argument: help, args,
plot, print, str, summary, example, names.
- Send to R the Sweave, knit and pdflatex commands.
* Omni completion (auto-completion) for R objects (.GlobalEnv and loaded
packages).
* Auto-completion of function arguments.
* Auto-completion of knitr chunk options.
* Ability to see R's documentation in a Vim's buffer:
- Automatic calculation of the best layout of the R documentation buffer
(split the window either horizontally or vertically according to the
available room).
- Automatic formatting of the text to fit the panel width.
- Send code and commands to R (useful to run examples).
- Syntax highlighting of R documentation.
* Object Browser (.GlobalEnv and loaded packages):
- Send commands with the object under cursor as argument.
- Call R's help() with the object under cursor as argument.
- Syntax highlighting of the Object Browser.
* Most of the plugin's behavior is customizable.

For screenshots see: http://www.lepem.ufc.br/jaa/vim-r-plugin.html

--------------------------------------------------------
*r-plugin-installation*
3. Installation

The installation instructions are split in four sections:

1. Instructions specific for Unix/Linux/OSX
2. Instructions specific for Windows
3. Troubleshooting
4. Optional steps

3.1. Instructions for Unix (Linux, OS X, etc.)

If you are an unexperienced Vim user, start a terminal emulator and type in
it: vimtutor<Enter>

Before installing the plugin, you should install its dependencies:

   Depends:

In addition to the most commonly used features, the plugin
requires: +python or +python3, +clientserver and +conceal.

Note: If you use Neovim, +python, +python3 and
+clientserver features are not required, but the python
executable must be in your PATH.

Note: If you use Mac OS X, read about the bugs that affect it:
r-plugin-nox.

R >= 3.0.0: http://www.r-project.org/

vimcom = 1.0-0: http://www.lepem.ufc.br/jaa/vimcom.html

Tmux >= 1.8:   http://tmux.sourceforge.net
Tmux is necessary to send commands from Vim to R Console.

   Suggests:

colorout:      http://www.lepem.ufc.br/jaa/colorout.html
Colorizes the R output.

setwidth:      An R package that can be installed with the command
install.packages("setwidth").
The library setwidth adjusts the value of options("width")
whenever the terminal is resized.

ncurses-term:  http://invisible-island.net/ncurses
Might be necessary if you want support for 256 colors at the
terminal emulator.

latexmk:       Automate the compilation of LaTeX documents.
See examples in vimrplugin_latexcmd.

Note: Vim, R, Tmux, ncurses-term and latexmk are already packaged for most
GNU/Linux distributions and other Unix variants. Unfortunately their
installation instructions vary widely and are beyond the scope of this
documentation.

You need to activate plugins and indentation according to 'filetype'. You
should have at least the following options at the top or at near the very top
of your vimrc:

   set nocompatible
   syntax enable
   filetype plugin on
   filetype indent on

http://www.vim.org/scripts/script.php?script_id=2628

Start a terminal emulator, go to the directory where you have downloaded the
plugin and type:

   vim Vim-R-plugin.vmb

Then, in Vim, type:

   :so %

Press <Enter> and the plugin will be installed (because the plugin has many
files, you have to press the space bar a few times to finish the
installation). You should, then, quit Vim.

Note: If you need too install the plugin in a non default directory, do
:UseVimball [path]. In this case, the configuration of Vim's 'runtimepath'
must be done before the command "filetype on" in both the system and the user
vimrc files, otherwise, some file types might not be correctly recognized.

Start Vim again and edit an R script. Type <LocalLeader>rf to start R and run
the command below to get help configuring ~/.Rprofile, ~/.vimrc, ~/.tmux.conf,
and ~/.bashrc (the <LocalLeader> is \ by default):

   :RpluginConfig

The above command will guide you through the final configuration steps if you
answer y to all questions, but if you prefer to configure everything by

If you start either GVim or Vim in a terminal emulator the plugin will start R
in a external terminal emulator. If you start Vim inside of a Tmux session,
the plugin will split the Tmux window in two and start R in the other pane.

The recommended way of running the plugin on Linux is running Vim inside a
Tmux session. If you do not use Tmux frequently, it is recommended that you
create a custom Bash function as explained in the section r-plugin-tmux,
especially the tip r-plugin-tvim (the above command :RpluginConfig should do
this for you).

Note: On Mac OS X, in both Vim and GVim, the plugin will use AppleScript to
send commands to the R Console application unless vimrplugin_applescript = 0.
Some users have reported more luck with iTerm than with the default Mac OS X
terminal emulator.

If you want to uninstall the plugin, do

   :RmVimball Vim-R-plugin

3.2. Instructions for Windows 

Before installing the plugin, you should install several external
dependencies:

* R's version must be >= 3.0.0: http://www.r-project.org/

* vimcom = 1.0-0: http://www.lepem.ufc.br/jaa/vimcom.html

Note: If you cannot build vimcom yourself, you will want to

* Python 2.7.6 (32 bit):
http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi
Do not choose the X86-64 version because it will not work.

* pywin32:

Note: The above versions of Python and pywin32 are known to work with
the official GVim 7.4 binary. The default download may not match the
Python version Vim was linked against: then you have to "View all files"
on the download page to find the file that matches exactly the above
versions.

http://www.vim.org/scripts/script.php?script_id=2628

and open the directory where you have downloaded it, right click on it and
choose "Edit with Vim".

Then, in Vim, type:

   :so %

Press <Enter> and the plugin will be installed (because the plugin has many
files, you have to press the space bar a few times to finish the
installation). You should, then, quit Vim.

Note: If you need too install the plugin in a non default directory, do
:UseVimball [path]. In this case, the configuration of Vim's 'runtimepath'
must be done before the command "filetype on" in both the system and the user
vimrc files, otherwise, some file types might not be correctly recognized.

Start GVim again and edit an R script. You can right click a .R file and
choose "Edit with Vim" or create a new one with the Normal mode command:

   :e example.R

To finish the installation, you have to start R to run a configuration script.

   R
   Start/Close
   Start R (default)

If R does not start and you get an error message instead, you may want to
set the path to your Rgui.exe in your vimrc, for example (please adapt to

   let vimrplugin_r_path = 'C:\Program Files\R\R-3.1.0\bin\i386'

Finally, click on the menu bar

   R
   Configure (Vim-R)

The above command will guide you through the final configuration steps if you

You may have to adjust the value of vimrplugin_sleeptime.

If you want to uninstall the plugin, do

   :RmVimball Vim-R-plugin

3.3. Troubleshooting (if the plugin doesn't work)

Note: The <LocalLeader> is '\' by default, but if you have run the
:RpluginConfig  command the <LocalLeader> may have been changed to ','.

The plugin is a file-type plugin. It will be active only if you are editing
a .R, .Rnw, .Rd, Rmd, or Rrst file. The menu items will not be visible and the
key bindings will not be active while editing either unnamed files or files
with name extensions other than the mentioned above. If the plugin is active,
pressing <LocalLeader>rf should start R.

Did you see warning messages but they disappeared before you have had time to
read them? Type the command :messages in Normal mode to see them again.

Are you using Debian, Ubuntu or other Debian based Linux distribution? If yes,
you may prefer to install the Debian package available at:

http://www.lepem.ufc.br/jaa/vim-r-plugin.html

Did you see the message "VimCom port not found"? This means that R is not
running, the vimcom package is not installed (or is installed but is not
loaded), or R was not started by Vim.

3.4. Optional steps

3.4.1 Customize the plugin

section Indenting setup (r-plugin-indenting) of this document.

3.4.2 Install additional plugins

You may be interested in installing additional general plugins to get
functionality not provided by this file type plugin. ShowMarks and snipMate
edit Rnoweb files, you may want to try LaTeX-Box for omnicompletion of LaTeX
code (see r-plugin-latex-box for details).

3.4.3 Add buttons to GVim

bar.

--------------------------------------------------------
*r-plugin-use*
4. Use

4.1. Key bindings

Note: The <LocalLeader> is '\' by default, but if you have run the
:RpluginConfig  command the <LocalLeader> may have been changed to ','.

Note: It is recommended the use of different keys for <Leader> and
<LocalLeader> to avoid clashes between filetype plugins and general plugins
key binds. See filetype-plugins, maplocalleader and r-plugin-localleader.

To use the plugin, open a .R or .Rnw or .Rd file with Vim and type
<LocalLeader>rf. Then, you will be able to use the plugin key bindings to send
commands to R.

This plugin has many key bindings, which correspond with menu entries. In the
list below, the backslash represents the <LocalLeader>. Not all menu items and
key bindings are enabled in all filetypes supported by the plugin (r, rnoweb,
rhelp, rrst, rmd).

Menu entry                                Default shortcut
Start/Close
. Start R (default)                                  \rf
. Start R --vanilla                                  \rv
. Start R (custom)                                   \rc
--------------------------------------------------------
. Close R (no save)                                  \rq
--------------------------------------------------------

Send
. File                                               \aa
. File (echo)                                        \ae
. File (open .Rout)                                  \ao
--------------------------------------------------------
. Block (cur)                                        \bb
. Block (cur, echo)                                  \be
. Block (cur, down)                                  \bd
. Block (cur, echo and down)                         \ba
--------------------------------------------------------
. Chunk (cur)                                        \cc
. Chunk (cur, echo)                                  \ce
. Chunk (cur, down)                                  \cd
. Chunk (cur, echo and down)                         \ca
. Chunk (from first to here)                         \ch
--------------------------------------------------------
. Function (cur)                                     \ff
. Function (cur, echo)                               \fe
. Function (cur and down)                            \fd
. Function (cur, echo and down)                      \fa
--------------------------------------------------------
. Selection                                          \ss
. Selection (echo)                                   \se
. Selection (and down)                               \sd
. Selection (echo and down)                          \sa
--------------------------------------------------------
. Paragraph                                          \pp
. Paragraph (echo)                                   \pe
. Paragraph (and down)                               \pd
. Paragraph (echo and down)                          \pa
--------------------------------------------------------
. Line                                                \l
. Line (and down)                                     \d
. Line (and new one)                                  \q
. Left part of line (cur)                       \r<Left>
. Right part of line (cur)                     \r<Right>
. Line (evaluate and insert the output as comment)    \o
--------------------------------------------------------

Command
. List space                                         \rl
. Clear console                                      \rr
. Clear all                                          \rm
--------------------------------------------------------
. Print (cur)                                        \rp
. Names (cur)                                        \rn
. Structure (cur)                                    \rt
--------------------------------------------------------
. Arguments (cur)                                    \ra
. Example (cur)                                      \re
. Help (cur)                                         \rh
--------------------------------------------------------
. Summary (cur)                                      \rs
. Plot (cur)                                         \rg
. Plot and summary (cur)                             \rb
--------------------------------------------------------
. Set working directory (cur file path)              \rd
--------------------------------------------------------
. Sweave (cur file)                                  \sw
. Sweave and PDF (cur file)                          \sp
. Sweave and PDF (cur file, verbose) (Windows)       \sv
. Sweave, BibTeX and PDF (cur file) (Linux/Unix)     \sb
--------------------------------------------------------
. Knit (cur file)                                    \kn
. Knit and PDF (cur file)                            \kp
. Knit, BibTeX and PDF (cur file) (Linux/Unix)       \kb
. Knit and Beamer PDF (cur file) (only .Rmd)         \kl
. Knit and HTML (cur file, verbose) (only .Rmd)      \kh
. Knit and PDF (cur file, verbose) (Windows)         \kv
. Spin (cur file) (only .R)                          \ks
. Slidify (cur file) (only .Rmd)                     \sl
--------------------------------------------------------
. Open PDF (cur file)                                \op
--------------------------------------------------------
. Build tags file (cur dir)                  :RBuildTags
--------------------------------------------------------

Edit
. Insert "<-"                                          _
. Complete object name                              ^X^O
. Complete function arguments                       ^X^A
--------------------------------------------------------
. Indent (line)                                       ==
. Indent (selected lines)                              =
. Indent (whole buffer)                             gg=G
--------------------------------------------------------
. Toggle comment (line, sel)                         \xx
. Comment (line, sel)                                \xc
. Uncomment (line, sel)                              \xu
. Add/Align right comment (line, sel)                 \;
--------------------------------------------------------
. Go (next R chunk)                                   gn
. Go (previous R chunk)                               gN
--------------------------------------------------------

Object Browser
. Show/Update                                        \ro
. Expand (all lists)                                 \r=
. Collapse (all lists)                               \r-
. Toggle (cur)                                     Enter
--------------------------------------------------------

Help (plugin)
Help (R)                                            :Rhelp
Configure (Vim-R)                           :RpluginConfig
--------------------------------------------------------

Please see r-plugin-key-bindings to learn how to customize the key bindings
without editing the plugin directly.

The plugin commands that send code to R Console are the most commonly used. If
the code to be sent to R has a single line it is sent directly to R Console,
but if it has more than one line (a selection of lines, a block of lines
between two marks, a paragraph etc) the lines are written to a file and the
plugin sends to R the command to source the file. You should type quickly
<LocalLeader>d to send to R Console the line currently under the cursor. If
you want to see what lines are being sourced when sending a selection of
lines, you should do either <LocalLeader>se or <LocalLeader>sa instead of
<LocalLeader>ss.

If the cursor is over the header of an R chunk with the child option (from
Rnoweb, RMarkdown or RreStructuredText document), and you use one of the
commands that send a single line of code to R, then the plugin will send to R
the command to knit the child document.

After the commands that send, sweave or knit the current buffer, Vim will save
the current buffer if it has any pending changes before performing the tasks.
After <LocalLeader>ao, Vim will run "R CMD BATCH --no-restore --no-save" on
the current file and show the resulting .Rout file in a new tab. Please see
vimrplugin_routnotab if you prefer that the file is open in a new split
window. Note: The command <LocalLeader>ao, silently writes the current buffer
to its file if it was modified and deletes the .Rout file if it exists.

R syntax uses " <- " to assign values to variables which is inconvenient to
type. In insert mode, typing a single underscore, "_", will write " <- ",
unless you are typing inside a string. The replacement will always happen if
syntax highlighting is off (see :syn-on and :syn-off). If necessary, it is
possible to insert an actual underscore into your file by typing a second
underscore. This behavior is similar to the EMACS ESS mode some users may be
familiar with and is enabled by default. You have to change the value of
vimrplugin_assign to disable underscore replacement.

When you press <LocalLeader>rh, the plugin shows the help for the function
under the cursor. The plugin also checks the class of the object passed as
argument to the function to try to figure out whether the function is a
generic one and whether it is more appropriate to show a specific method. The
same procedure is followed with <LocalLeader>rp, that is, while printing an
object. For example, if you run the code below and, then, press
<LocalLeader>rh and <LocalLeader>rp over the two occurrences of summary, the
plugin will show different help documents and print different function methods
in each case:

   y <- rnorm(100)
   x <- rnorm(100)
   m <- lm(y ~ x)
   summary(x)
   summary(m)

When completing object names (CTRL-X CTRL-O) and function arguments (CTRL-X
CTRL-A) you have to press CTRL-N to go foward in the list and CTRL-P to go
backward (see popupmenu-completion). Note: if using Vim in a terminal
emulator, Tmux will capture the CTRL-A command. You have to do CTRL-A twice to
pass a single CTRL-A to Vim. For rnoweb, rmd and rrst file types, CTRL-X
CTRL-A can also be used to complete knitr chunk options if the cursor is

If R is not running or if it is running but is busy the completion will be
based on information from the packages listed by vimrplugin_permanent_libs
(provided that the libraries were loaded at least once during a session of
Vim-R-plugin usage). Otherwise, the pop up menu for completion of function
arguments will include an additional line with the name of the library where
the function is (if the function name can be found in more than one library)
and the function method (if what is being shown are the arguments of a method
and not of the function itself). For library() and require(), when completing
the first argument, the popup list shows the names of installed packages, but
only if R is running.

To get help on an R topic, type in Vim (Normal mode):

   :Rhelp topic

The command may be abbreviated to  :Rh  and you can either press <Tab> to
trigger the autocompletion of R objects names or hit CTRL-D to list the
possible completions (see cmdline-completion for details on the various ways
of getting command-line completion). The list of objects used for
completion is the same available for omnicompletion (see
vimrplugin_permanent_libs).

You can source all .R files in a directory with the Normal mode command
:RSourceDir, which accepts an optional argument (the directory to be sourced).
*:Rinsert*
The command  :Rinsert <cmd>  inserts one or more lines with the output of the
R command sent to R. By using this command we can avoid the need of copying
and pasting the output R from its console to Vim. For example, to insert the
output of dput(levels(var)), where var is a factor vector, we could do in
Vim:

   :Rinsert dput(levels(var))

The output inserted by  :Rinsert  is limited to 5012 characters.

The command  :Rformat  calls the function tidy.source() of formatR package
to format either the entire buffer or the selected lines. The value of the
width.cutoff argument is set to the buffer's 'textwidth' if it is not
outside the range 20-180. Se R help on tidy.source for details on how to
control the function behavior.

4.2. Edition of rnoweb files

In Rnoweb files (.Rnw), when the cursor is over the @ character, which
finishes an R chunk, the sending of all commands to R is suspended and the
shortcut to send the current line makes the cursor to jump to the next chunk.
While editing rnoweb files, the following commands are available in Normal
mode:

[count]gn : go to the next chunk of R code
[count]gN : go to the previous chunk of R code

The commands <LocalLeader>cc, ce, cd and ca send the current chunk of R code
to R Console. The command <LocalLeader>ch sends the R code from the first
chunk up to the current line.

4.3. Omni completion and the highlighting of functions

The plugin adds some features to the default syntax highlight of R code. One
such feature is the highlight of R functions. However, functions are
highlighted only if their libraries are loaded by R (but see
vimrplugin_permanent_libs).

Note: If you have too many loaded packages Vim may be unable to load the list
of functions for syntax highlight.

4.4. Omni completion

Vim can automatically complete the names of R objects when CTRL-X CTRL-O is
pressed in insert mode (see omni-completion for details). Omni completion
shows in a pop up menu the name of the object, its class and its environment
(most frequently, its package name). If the object is a function, its
arguments are shown in a separate window (see 'completeopt' if you want to
disable the preview window).

If a data.frame is found, while building the list of objects, the columns in
the data.frame are added to the list. When you try to use omni completion to
complete the name of a data.frame, the columns are not shown. But when the
data.frame name is already complete, and you have inserted the '' symbol, omni completion will show the column names. Only the names of objects in .GlobalEnv and in loaded libraries are completed, and the clientserver feature is required to get the list of loaded libraries automatically updated. If either R is not running or Vim is running without the clientserver feature, only objects of libraries listed in vimrplugin_permanent_libs will have their names completed. Vim uses one file to store the names of .GlobalEnv objects and a list of files for all other objects. The .GlobalEnv list is stored in the /tmp/r-plugin-yourlogin directory and is deleted when you quits Vim. The other files are stored in ~/.vim/r-plugin/objlist/ and remain available until you manually delete them. 4.5. The Object Browser You have to do <LocalLeader>ro to either start or updated the Object Browser. The Object Browser has two views: .GlobalEnv and Libraries. If you either press <Enter> or double click (GVim or Vim with 'mouse' set to "a") on the first line of the Object Browser it will toggle the view between the objects in .GlobalEnv and the currently loaded libraries. The Object Browser requires the +clientserver feature to be automatically updated and the +conceal feature to correctly align list items. In the .GlobalEnv view, if an object has the attribute "label", it will also be displayed. Please, see the R help for package vimcom for some options to control the Object Browser behavior. In the Object Browser window, while in Normal mode, you can either press <Enter> or double click (GVim only) over a data.frame or list to show/hide its elements (not if viewing the content of loaded libraries). If you are running R in an environment where the string UTF-8 is part of either LC_MESSAGES or LC_ALL variables, unicode line drawing characters will be used to draw lines in the Object Browser. This is the case of most Linux distributions. In the Libraries view, you can either double click or press <Enter> over a library to see its objects. In the Object Browser, the libraries have the color defined by the PreProc highlighting group, and the other objects have their colors defined by the return value of some R functions. Each line in the table below shows a highlighting group and the corresponding R function (if any) used to classify the objects: PreProc libraries Number is.numeric() String is.character() Special is.factor() Boolean is.logical() Type is.list() Function is.function() Statement isS4() One limitation is that objects made available by the command data() may not have their classes recognized in the GlobalEnv view. 4.6. Commenting and uncommenting lines You can toggle the state of a line as either commented or uncommented by typing <LocalLeader>xx. The string used to comment the line will be "# ", "## " or "### ", depending on the values of vimrplugin_indent_commented and r_indent_ess_comments. You can also add the string "# " to the beginning of a line by typing <LocalLeader>xc and remove it with <LocalLeader>xu. In this case, you can set the value of vimrplugin_rcomment_string to control what string will be added to the begining of the line. Example:  let vimrplugin_rcomment_string = "# " Finally, you can also add comments to the right of a line with the <LocalLeader>; shortcut. By default, the comment starts at the 40th column, which can be changed by setting the value of r_indent_comment_column, as below:  let r_indent_comment_column = 20 If the line is longer than 38 characters, the comment will start two columns after the last character in the line. If you are running <LocalLeader>; over a selection of lines, the comments will be aligned according to the longest line. Note: While typing comments the leader comment string is automatically added to new lines when you reach 'textwidth' but not when you press <Enter>. Please, read the Vim help about 'formatoptions' and fo-table. For example, you can add the following line to your vimrc if you want the comment string being added after <Enter>:  autocmd FileType r setlocal formatoptions-=t formatoptions+=croql Tip: You can use Vim substitution command :%s/#.*// to delete all comments in a buffer (see :s and pattern-overview). 4.7. Build a tags file to jump to function definitions *:RBuildTags* Vim can jump to functions defined in other files if you press CTRL-] over the name of a function, but it needs a tags file to be able to find the function definition (see tags-and-searches). The command :RBuildTags calls the R function rtags() to build the tags file for the R scripts in the current directory. Please read r-plugin-tagsfile to learn how to create a tags file referencing source code located in other directories, including the entire R source code. 4.8. Tmux usage *r-plugin-tmux* When running either GVim or Vim in a terminal emulator (Linux/Unix only), the Vim-R-plugin will use Tmux to start R in a separate terminal emulator. R will be running inside a Tmux session, but you will hardly notice any difference from R running directly in the terminal emulator. The remaining of this section refers to the case of starting R when Vim already is in a Tmux session, that is, if you do:  tmux  vim --servername VIM filename.R  exit In this case, the terminal window is split in two regions: one for Vim and the other for Tmux. Then, it's useful (but not required) to know some Tmux commands. After you finished editing the file, you have to type exit to quit the Tmux session. Note: Neovim does not require the --servername VIM argument. 4.8.1 tvim *r-plugin-tvim* If, as recommended, you always prefer to run Tmux before running Vim you could create a Bash function called tvim (please, see the ~/.bashrc example at r-plugin-quick-setup). Then you will be able to start a Tmux session running Vim by typing:  tvim filename.R Using the tvim function, the Tmux session is finished when you quits Vim. That is, the main advantage of using tvim is that you do not have to type tmux before and exit after the edition of the file. Moreover, the tvim command also pass the --servername argument to Vim, which is required to update the Object Browser and functions highlight. If you are going to run Vim inside Tmux, than you should create your ~/.tmux.conf if it does not exist yet. You may put the lines below in your ~/.tmux.conf as a starting point to your own configuration file:  set-option -g prefix C-a  unbind-key C-b  bind-key C-a send-prefix  set-window-option -g mode-keys vi  set -g terminal-overrides 'xterm*:smcup@:rmcup@'  set -g mode-mouse on  set -g mouse-select-pane on  set -g mouse-resize-pane on 4.8.2 Key bindings and mouse support The Tmux configuration file suggested above configures Tmux to use vi key bindings. It also configures Tmux to react to mouse clicks. You should be able to switch the active pane by clicking on an inactive pane, to resize the panes by clicking on the border line and dragging it, and to scroll the R Console with the mouse wheel. When you use the mouse wheel, Tmux enters in its copy/scroll back mode (see below). The configuration script also sets <C-a> as the Tmux escape character (the default is <C-b>), that is, you have to type <C-a> before typing a Tmux command. Below are the most useful key bindings to use Tmux with the above tmux.conf: <C-a>arrow keys : Move the cursor to the Tmux panel above, below, at the right or at the left of the current one. <C-a><C-Up> : Move the panel division upward one line, that is, resize the panels. Repeat <C-Up> to move more. <C-Down> will move the division downward one line. If you are using the vertical split, you should use <C-Left> and <C-Right> to resize the panels. <C-a>[ : Enter the copy/scroll back mode. You can use <PgUp>, <PgDown> and vi key bindings to move the cursor around the panel. Press q to quit copy mode. <C-a>] : Paste the content of Tmux paste buffer. <C-a>z : Hide/show all panes except the current one. Note: If you mistakenly press <C-a><C-z>, you have to type fg to get Tmux back to the foreground. While in the copy and scroll back mode, the following key bindings are very useful: q : Quit the copy and scroll mode. <Space> : Start text selection. v<Space> : Start rectangular text selection. <Enter> : Copy the selection to Tmux paste buffer. Please, read the manual page of Tmux if you want to change the Tmux configuration and learn more commands. To read the Tmux manual, type in the terminal emulator:  man tmux Note: Because <C-a> was configured as the Tmux escape character, it will not be passed to applications running under Tmux. To send <C-a> to either R or Vim you have to type <C-a><C-a>. 4.8.3 Copying and pasting You do not need to copy code from Vim to R because you can use the plugin's shortcuts to send the code. For pasting the output of R commands into Vim's buffer, you can use the command :Rinsert. If you want to copy text from an application running inside the Tmux to another application also running in Tmux, as explained in the previous subsection, you can enter in Tmux copy/scroll mode, select the text, copy it, switch to the other application pane and, then, paste. However, if you want to copy something from either Vim or R to another application not running inside Tmux, Tmux may prevent the X server from capturing the text selected by the mouse. The solution is to disable mouse support in Tmux. You will be able to toggle mouse support on and off by typing <C-a>m if you add the following line to your ~/.tmux.conf:  bind m run-shell '( if [ "mode-mouse on" = "(tmux show-window-option | grep mode-mouse)" ]; then toggle=off; else toggle=on; fi; tmux display-message "mouse $toggle"; tmux set-option -w mode-mouse$toggle ; for cmd in mouse-select-pane mouse-resize-pane mouse-select-window; do tmux set-option -g $cmd$toggle ; done;) > /dev/null 2>&1'

4.8.2 Remote access
*r-plugin-remote*
Note: Neovim does not require the --servername VIM argument. Thus, you also do
not need to enable the X11 Forwarding for omnicompletion, etc.

If you need to access Vim in a remote Unix machine through ssh, and if you
want to get omnicompletion, syntax highlight of function names and the Object
Browser working properly, then you have to:

- Enable X11 Forwarding in the remote machine.

- Have Vim in the remote machine compiled with clientserver feature.

- Have the X Server running in the local machine.

- Pass either the -X or the -Y argument to ssh, as in the examples
below:

     ssh -X yourlogin@remote.address
     ssh -Y yourlogin@remote.address

- Start Tmux and, then, Vim with the --servername argument:

     tmux
     vim --servername VIM script.R

With Tmux, you can detach the Vim-R session and reattach it latter (but the
connection with the XServer could be lost in the process). This is useful if
you plan to begin the use the Vim-R-plugin in a machine and latter move to
another computer and access remotely your previous Vim-R session. Below is the
step-by-step procedure to run the Vim-R remotely:

- Start Tmux:
tmux

- Start Vim:
vim script.R

- Use Vim to start an R session:
<LocalLeader>rf

- Send code from Vim to R, and, then, detach Vim and R with <C-a>d
The command will be <C-b>d if you have not set <C-a> as the escape

- Some time latter (even if accessing the machine remotely) reattach the
Tmux session:
tmux attach

--------------------------------------------------------
*r-plugin-known-bugs*
5. Known bugs and workarounds

The bugs that are known to exist but that will not be fixed are listed in this
section. Some of them can not be fixed because they depend on either R or Vim
missing features; others would be very time consuming to fix without breaking
anything.

5.1. R's source() issues

The R's source() function of base package prints an extra new line between
commands if the option echo = TRUE, and error and warning messages are printed
only after the entire code is sourced, which makes it more difficult to find
errors in the code sent to R. Details:

https://stat.ethz.ch/pipermail/r-devel/2012-December/065352.html

5.2. The clipboard's content is lost (Windows only)

On Windows, the plugin copies the command that will be sent to R into the
clipboard. Thus, if you have anything in the clipboard it will be lost while
using the plugin.

5.3. The menu may not reflect some of your custom key bindings

If you have created a custom key binding for the Vim-R-plugin, the menu in
GVim will not always reflect the correct key binding if it is not the same for
Normal, Visual and Insert modes.

5.4. Syntactically correct code may be wrongly indented

If the Vim-R-plugin indents your code wrongly you may get the correct
indentation by adding braces and line breaks to it. For example, try to
indent the code below:

    # This code will be wrongly indented:

    levels(x) <- ## nl == nL or 1
        if (nl == nL) as.character(labels)
        else paste(labels, seq_along(levels), sep = "")
    class(x) <- c(if(ordered) "ordered", "factor")

    # But this one will be correctly indented:

    levels(x) <- ## nl == nL or 1
        if (nl == nL)
            as.character(labels)
        else
            paste(labels, seq_along(levels), sep = "")
    class(x) <- c(if(ordered) "ordered", "factor")

See: https://github.com/jcfaria/Vim-R-plugin/issues/77

5.5. Functions are not always correctly sent to R

The plugin is only capable of recognizing functions defined using the <-
operator. See: https://github.com/jcfaria/Vim-R-plugin/issues/94

5.6. Wrong message that "R is busy" (Windows only)

On Windows, when code is sent from Vim to R Console, the vimcom library
sets the value of the internal variable r_is_busy to 1. The value is set
back to 0 when any code is successfully evaluated. If you send invalid code to
R, there will be no successful evaluation of code and, thus, the value of
r_is_busy will remain set to 1. Then, if you try to update the object
browser, see the R documentation for any function, or do other tasks that
require the hidden evaluation of code by R, the vimcom library will
refuse to do the tasks to avoid any risk of corrupting R's memory. It will
tell Vim that "R is busy" and Vim will display this message. Everything should
work as expected again after any valid code is executed in the R Console.

5.7. Bugs that affect Mac OS X, Linux Console and ...
*r-plugin-nox*
Note: The bug described in this section does not affect Neovim.

If you use MacVim, run Vim in the Linux Console or start Vim in a terminal
emulator without the command line argument --servername, Vim will not
receive remote messages and the vimcom package will display one of the
following messages:

MacVim isn't fully supported by vimcom.
Vim was built without the 'clientserver' feature.
Did you pass the --servername argument to Vim?
There is no X Server running.
Vim's servername is unknown.

To avoid the message, you should start vim with the --servername argument,
as below:

   vim --servername VIM script.R

To avoid having to type this argument every time that you start Vim, please
either run :RpluginConfig or look at the example in r-plugin-bash-setup.

If the --servername argument does not work in your case, you can put the
following line in your ~/.Rprofile to suppress the message:

   options(vimcom.verbose = -1)

When Vim cannot receive messages, the result is:

* The Object Browser is not automatically updated. You have to do
<LocalLeader>ro to update it manually.

* Syntax highlight of function names and the list of objects for
omnicompletion are not immediately updated after you load a new R
package. They are updated only after the CursorHold event is triggered,
that is, after you stay 'updatetime' milliseconds in Normal mode doing
nothing. For a workaround, see vimrplugin_permanent_libs.

On Linux you may find Vim binaries without the clientserver feature if
you install packages such as vim-nox on Debian/Ubuntu or vim-enhanced on
Fedora/Red Hat. If you want to use Vim in a terminal emulator in Fedora/Red
Hat, you may want to create a symbolic link to "gvim" named "vim". You still
have to explicitly start the server with the argument --servername.

The R package vimcom has support only for Windows and X11 interprocess
communication systems while MacVim is a Cocoa application, that is,
vimcom is unable to send messages to MacVim too. For vimcom, running
MacVim is equivalent to running Vim without the clientserver feature.

On Mac OS X, to get omnicompletion, syntax highlight of function names and the
Object Browser working properly, in addition to using Vim built with X11
support, and not MacVim, you also have to install XQuartz server (X11.app).
A user reported success with the following procedure:

   brew install vim --with-client-server
   tmux
   /usr/local/Cellar/vim/7.4.273/bin/vim --servername VIM r_script.R

5.8. R must be started by Vim

The communication between Vim and R will work only if R was started by Vim
through the <LocalLeader>rf command because the plugin was designed to connect
each Vim instance with its own R instance. If you start R before Vim, it will
not inherit from Vim the environment variables VIMRPLUGIN_TMPDIR,
VIMRPLUGIN_HOME, VIMEDITOR_SVRNM and VIMINSTANCEID. The first one is the path
used by the R package vimcom to save temporary files used by the Vim-R-plugin
to: perform omnicompletion, show R documentation in a Vim buffer, and update
the Object Browser. The last one is used by the Vim-R-plugin to know that it is
not connecting to an R instance initiated by another Vim instance. If you use
Vim to start R, but then closes Vim, the VIMINSTANCEID variable in R will
become outdated. Additionally, the Vim-R-plugin sets the value of its internal
variable SendCmdToR from SendCmdToR_fake to the appropriate value when R is
successfully started. It is possible to set the values of all these variables
manually, but, as you can see below, it is not practical to do so. If you have
either started R before Vim or closed Vim and opened it again and really want
full communication between Vim and R, you can try the following (not all
procedures are necessary for all cases):

In Normal mode Vim do:

   :echo $VIMRPLUGIN_TMPDIR  :echo$VIMINSTANCEID
   :echo $VIMEDITOR_SVRNM  :echo$VIMRPLUGIN_HOME

In R do:

   detach("package:vimcom", unload = TRUE)
   Sys.setenv(VIMRPLUGIN_TMPDIR="T") # where "T" is what Vim has echoed
   library(vimcom)
   Sys.setenv(VIMINSTANCEID="I")     # where "I" is what Vim has echoed
   Sys.setenv(VIMEDITOR_SVRNM"="S")  # where "S" is what Vim has echoed
   Sys.setenv(VIMRPLUGIN_HOME"="H")  # where "H" is what Vim has echoed

If you are running R in a terminal emulator (Linux/Unix) Vim still needs to
know the name of Tmux session and Tmux pane where R is running.

So, in R do:

   Sys.getenv("TMUX_PANE")

and the following Tmux command:

   <Ctrl-A>:display-message -p '#S'<Enter><Enter>

And in Normal mode Vim do:

   :let rplugin_rconsole_pane = "X"
   :let rplugin_tmuxsname = "Y"

Finally, do one of the commands below in Normal mode Vim, according to how R
is running:

   let SendCmdToR = function('SendCmdToR_TmuxSplit')
   let SendCmdToR = function('SendCmdToR_Term')
   let SendCmdToR = function('SendCmdToR_OSX')
   let SendCmdToR = function('SendCmdToR_Windows')

--------------------------------------------------------
*r-plugin-options*
6. Options

vimrplugin_term              External terminal to be used
vimrplugin_term_cmd          Complete command to open an external terminal
vimrplugin_Rterm             On Windows, use Rterm.exe
vimrplugin_assign            Convert '_' into ' <- '
vimrplugin_assign_map        Choose what to convert into ' <- '
vimrplugin_rnowebchunk       Convert '<' into '<<>>=\n@' in Rnoweb files
vimrplugin_objbr_place       Placement of Object Browser
vimrplugin_objbr_w           Initial width of Object Browser window
vimrplugin_external_ob       Run Object Browser on external terminal
vimrplugin_vimpager          Use Vim to see R documentation
vimrplugin_editor_w          Minimum width of R script buffer
vimrplugin_help_w            Desired width of R documentation buffer
vimrplugin_i386              Use 32 bit version of R
vimrplugin_r_path            Directory where R is
vimrplugin_r_args            Arguments to pass to R
vimrplugin_permanent_libs    Objects for omnicompletion and syntax highlight
vimrplugin_routmorecolors    More syntax highlighting in R output
vimrplugin_routnotab         Show output of R CMD BATCH in new window
vimrplugin_indent_commented  Indent lines commented with the \xx command
vimrplugin_sleeptime         Delay while sending commands in MS Windows
vimrplugin_notmuxconf        Don't use a specially built Tmux config file
vimrplugin_rconsole_height   The number of lines of R Console (Tmux split)
vimrplugin_vsplit            Make Tmux split the window vertically
vimrplugin_rconsole_width    The number of columns of R Console (Tmux split)
vimrplugin_tmux_title        Set Tmux window title to "VimR"
vimrplugin_applescript       Use osascript in Mac OS X
vimrplugin_listmethods       Do vim.list.args() instead of args()
vimrplugin_specialplot       Do vim.plot() instead of plot()
vimrplugin_maxdeparse        Argument to R source() function
vimrplugin_latexcmd          Command to run on .tex files
vimrplugin_sweaveargs        Arguments do Sweave()
vimrplugin_map_r             Use 'r' to send lines and selected text
vimrplugin_ca_ck             Add ^A^K to the beginning of commands
vimrplugin_openpdf           Open PDF after processing rnoweb file
vimrplugin_openpdf_quietly   Open PDF quietly
vimrplugin_openhtml          Open HTML after processing either Rrst or Rmd
vimrplugin_strict_rst        Code style for generated rst files
vimrplugin_insert_mode_cmds  Allow R commands in insert mode
vimrplugin_allnames          Show names which begin with a dot
vimrplugin_rmhidden          Remove hidden objects from R workspace
vimrplugin_restart           Restart R if it is already running
vimrplugin_show_args         Show extra information during omnicompletion
vimrplugin_vim_wd            Start R in Vim's working directory

6.1. Terminal emulator (Linux/Unix only)
*vimrplugin_term*
The plugin uses the first terminal emulator that it finds in the following
list:
1. gnome-terminal,
2. konsole,
3. xfce4-terminal,
4. iterm,
5. Eterm,
6. (u)rxvt,
7. aterm,
8. roxterm,
9. terminator,
10. xterm.

If Vim does not select your favorite terminal emulator, you may define it in
your vimrc by setting the variable vimrplugin_term, as shown below:

   let vimrplugin_term = "xterm"
   let vimrplugin_term = "/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal"

*vimrplugin_term_cmd*
If your terminal emulator is not listed above, or if you are not satisfied
with the way your terminal emulator is called by the plugin, you may define in
your vimrc the variable vimrplugin_term_cmd, as in the examples below:

   let vimrplugin_term_cmd = "gnome-terminal --title R -e"
   let vimrplugin_term_cmd = "terminator --title R -x"
   let vimrplugin_term_cmd = "/Applications/Utilities/iTerm.app/Contents/MacOS/iTerm -t R"

Please, look at the manual of your terminal emulator to know how to call it.
The last argument must be the one which precedes the command to be executed.

6.2. Use Rterm.exe on Windows
*vimrplugin_Rterm*
If you rather prefer to use Rterm.exe than Rgui.exe, you have to set both the
"Quick Edit Mode" and the "Insert mode" on either the Windows 7 PowerShell or
the Windows XP Command Prompt (click on the title bar and choose
"properties"). Then, you should put in your vimrc:

   let vimrplugin_Rterm = 1

Technical details: The plugin copies the code to be sent to R to the Windows
clipboard and, then, sends the key strokes CTRL-V to R Console window.
However, neither the Windows 7 PowerShell nor the Windows XP Command Prompt
has a keyboard shortcut to "paste". The solution is to set the "Quick Edit
Mode" on either PowerShell or Command Prompt and to send a "Right click" to
it.

6.3. Assignment operator and Rnoweb completion of code block
*vimrplugin_rnowebchunk*
*vimrplugin_assign_map*
*vimrplugin_assign*
In Rnoweb files, a '<' is replaced with '<<>>=\n@'. To disable this feature,
put in your vimrc:

   let vimrplugin_rnowebchunk = 0

While editing R code, '_' is replaced with ' <- '. If want to bind other keys
to be replaced by ' <- ', set the value of vimrplugin_assign_map in your
vimrc, as in the example below which emulates RStudio behavior (may only
works on GVim):

   let vimrplugin_assign_map = "<M-->"

Note: If you are using Vim in a terminal emulator, you have to put in your
vimrc:

   set <M-->=^[-
   let vimrplugin_assign_map = "<M-->"

where ^[ is obtained by pressing CTRL-V CTRL-[ in Insert mode.

Note: You can't map <C-=>, as StatET does because in Vim only alphabetic
letters can be mapped in combination with the CTRL key.

To completely disable this feature, put in your vimrc:

   let vimrplugin_assign = 0

6.4. Object Browser options
*vimrplugin_objbr_place*
*vimrplugin_objbr_w*
*vimrplugin_external_ob*
By default, the object browser will be created with 40 columns. The minimum
width of the Object Browser window is 9 columns. You can change the object
browser's default width by setting the value of vimrplugin_objbr_w in your
vimrc, as below:

   let vimrplugin_objbr_w = 30

The Object Browser will always be created by splitting the Vim script window
if you are running either GVim or Vim not inside a Tmux session. However, if
running Vim in a terminal emulator inside a Tmux session, the Object Browser
will be created in an independent Vim instance in a Tmux panel beside the R
Console. Valid values for the Object Browser placement are "script" or
"console" and "right" or "left" separated by a comma. Examples:

   let vimrplugin_objbr_place = "script,right"
   let vimrplugin_objbr_place = "console,left"

If vimrplugin_external_ob = 1 and R is running in an external terminal
emulator, the Object Browser will be placed besides the R Console in the
external terminal emulator. In this case, the command <LocalLeader>rh will not
work on the Object Browser (you will see the message "Cmd not available").

6.5. Vim as pager for R help
*vimrplugin_vimpager*
*vimrplugin_editor_w*
*vimrplugin_help_w*
6.5.1. Quick setup

If you do not want to see R documentation in a Vim's buffer, put in your
vimrc:

   let vimrplugin_vimpager = "no"

If you want to use Vim to see R documentation even when looking for help in
the R console, you have to create a shell script in your path that will call
Vim in the right way. You can, for example, create a file named
~/bin/vimrpager to do that (see r-plugin-quick-setup).

6.5.2. Details and other options:

The plugin key bindings will remain active in the documentation buffer, and,
thus, you will be able to send commands to R as you do while editing an R
script. You can, for example, use <LocalLeader>rh to jump to another R help
document.

The valid values of vimrplugin_vimpager are:

"tab"       : Show the help document in a new tab. If there is already a
tab with an R help document tab, use it.
This is the default.
"vertical"  : Split the window vertically if the editor width is large
enough; otherwise, split the window horizontally and attempt
to set the window height to at least 20 lines.
"horizontal": Split the window horizontally.
"tabnew"    : Show the help document in a new tab.
"no"        : Do not show R documentation in Vim.

The window will be considered large enough if it has more columns than
vimrplugin_editor_w + vimrplugin_help_w. These variables control the minimum
width of the editor window and the help window, and their default values are,
respectively, 66 and 46. Thus, if you want to have more control over Vim's
behavior while opening R's documentations, you will want to set different
values to some variables in your vimrc, as in the example:

   let vimrplugin_editor_w = 80
   let vimrplugin_editor_h = 60

6.6. Use 32 bit version of R (Windows and Mac OS X only)
*vimrplugin_i386*
If you are using a 64 bit Windows or a 64 bit Mac OS X, but prefer to run the
32 bit version of R, put in your vimrc:

   let vimrplugin_i386 = 1

6.7. R path
*vimrplugin_r_path*
Vim will run the first R executable in the path. You can set an alternative R
path in your vimrc as in the examples:

   let vimrplugin_r_path = "/path/to/my/preferred/R/version/bin"
   let vimrplugin_r_path = "C:\\Program Files\\R\\R-3.0.1\\bin\\i386"

On Windows, Vim will try to find the R install path in the Windows Registry.

You can set a different R version for specific R scripts in your vimrc.
Example:

   autocmd BufReadPre ~/old* let vimrplugin_r_path='~/app/R-2.8.1/bin'

6.8. Arguments to R
*vimrplugin_r_args*
Set this option in your vimrc if you want to pass command line arguments to
R at the startup. Example:

   let vimrplugin_r_args = "--sdi --no-save --quiet"

On Linux, there is no default value for vimrplugin_r_args. On Windows, the
default value is "--sdi", but you may change it to "--mdi" if you do not like
the SDI style of the graphical user interface.

6.9. Omnicompletion and syntax highlight of R functions
*vimrplugin_permanent_libs*
The list of functions to be highlighted and the list of objects for
omnicompletion are built dynamically as the libraries are loaded by R.
However, you can set the value of vimrplugin_permanent_libs if you want that
the functions and objects of specific packages are respectively highlighted
and available for omnicompletion even if R is not running. By default, only
the functions of vanilla R are always highlighted. Below is the default value
of vimrplugin_permanent_libs:

   let vimrplugin_permanent_libs = "base,stats,graphics,grDevices,utils,methods"

You may also want to define the value of vimrplugin_permanent_libs if you are
running Vim without the clientserver feature.

6.10. More colorful syntax highlight of .Rout files
*vimrplugin_routmorecolors*
By default, the R commands in .Rout files are highlighted with the color of
comments, and only the output of commands has some of its elements highlighted
(numbers, strings, index of vectors, warnings and errors).

If you prefer that R commands in the R output are highlighted as they are in R
scripts, put the following in your vimrc:

   let vimrplugin_routmorecolors = 1

6.11. How to automatically open the .Rout file
*vimrplugin_routnotab*
After the command <LocalLeader>ao, Vim will save the current buffer if it has
any pending changes, run R CMD BATCH --no-restore --no-save on the current
file and show the resulting .Rout file in a new tab. If you prefer that the
file is open in a new split window, put in your vimrc:

   let vimrplugin_routnotab = 1

6.12. Indent commented lines
*vimrplugin_indent_commented*
You can type <LocalLeader>xx to comment out a line or selected lines. If the
line already starts with a comment string, it will be removed. After adding
the comment string, the line will be reindented by default. To turn off the
automatic indentation, put in your vimrc:

   let vimrplugin_indent_commented = 0

What string will be added to the beginning of the line depends on the values
of vimrplugin_indent_commented and r_indent_ess_comments according to the
table below (see r-plugin-indenting):

   vimrplugin_indent_commented   r_indent_ess_comments   string
                 1                        0                #
                 0                        0                #
                 1                        1                ##
                 0                        1                ###

6.13. Sleep time (Windows only)
*vimrplugin_sleeptime*
The plugin gives to R a small amount of time to process the paste command. The
default value is 0.2 second, but you should experiment different values. The
example show how to adjust the value of sleeptime in your vimrc:

   let vimrplugin_sleeptime = 0.1

6.14. Tmux configuration (Linux/Unix only)
*vimrplugin_notmuxconf*

GVim (or Vim running R in an external terminal emulator) runs Tmux with a
specially built configuration file. If you want to use your own ~/.tmux.conf,
put in your vimrc:

   let vimrplugin_notmuxconf = 1

If you opted for using your own configuration file, the plugin will write a
minimum configuration which will set the value of four environment variables
required for the communication with R and then source your own configuration
file (~/.tmux.conf).

6.15. Integration with Tmux (Linux/Unix only)
*vimrplugin_rconsole_height*
*vimrplugin_vsplit*
*vimrplugin_rconsole_width*
*vimrplugin_tmux_title*
These three options are valid only when Vim is started inside a Tmux session.
In this case, when you type <LocalLeader>rf, the terminal will be split in two
regions and R will run in one of them. By default, the Vim-R-plugin will tell
Tmux to split the terminal window horizontally and you can set in your
vimrc the initial number of lines of the Tmux pane running R as in the
example below:

   let vimrplugin_rconsole_height = 15

If you prefer to split it vertically:

   let vimrplugin_vsplit = 1

In this case, you can choose the initial number of columns of R Console:

   let vimrplugin_rconsole_width = 15

Tmux automatically renames window titles to the command currently running. The
Vim-R-plugin sets the title of the window where Vim and R are running to
"VimR". This title will be visible only if Tmux status bar is "on", and it is
useful only if you have created new windows with the <C-a>c command. You
can change the value of vimrplugin_tmux_title to either set a different title
or let Tmux set the title automatically. Examples:

   let vimrplugin_tmux_title = "Vim-R"
   let vimrplugin_tmux_title = "automatic"

6.16. Integration with AppleScript (OS X only)
*vimrplugin_applescript*
In Mac OS X, the plugin will try to send commands to R gui using AppleScript.
If you prefer either to run R and Vim in the same terminal emulator split in
two regions (Vim and R) or to run R in an external terminal emulator, put in
your vimrc:

   let vimrplugin_applescript = 0

If Vim is running inside Tmux, the terminal will be split in two regions.
Otherwise, R will start in an external terminal emulator.

6.17. Special R functions
*vimrplugin_listmethods*
*vimrplugin_specialplot*
The R function args() lists the arguments of a function, but not the arguments
of its methods. If you want that the plugin calls the function
vim.list.args() after <LocalLeader>ra, you have to add to your vimrc:

   let vimrplugin_listmethods = 1

By default, R makes a scatterplot of numeric vectors. The function vim.plot()
do both a histogram and a boxplot. The function can be called by the plugin
after <LocalLeader>rg if you put the following line in your vimrc:

   let vimrplugin_specialplot = 1

6.18. maxdeparse
*vimrplugin_maxdeparse*
You can set the argument maxdeparse to be passed to R's source() function.
Example:

   let vimrplugin_maxdeparse = 300

6.19. LaTeX command
*vimrplugin_latexcmd*
*vimrplugin_sweaveargs*
On Windows, the vimcom package calls tools::texi2dvi() to build the pdf
from the generated .tex file. On Linux/Unix, by default, it calls
latexmk -pdf to produce a pdf document from the .tex file produced by
either Sweave() or knit() command. If latexmk is not installed, it calls
pdflatex. You can use the option vimrplugin_latexcmd to change this
behavior. Example:

   let vimrplugin_latexcmd = "latex"

If you want to pass arguments do the Sweave() function, set the value of the
vimrplugin_sweaveargs variable.

6.20. Never unmake the R menu
Use this option if you want that the "R" menu item in GVim is not deleted when
you change from one buffer to another, for example, when going from an .R file
to a .txt one:

   let vimrplugin_never_unmake_menu = 1

When this option is enabled all menu items are created regardless of the file
type. If you have added R related tool bar buttons (see r-plugin-toolbar)
the buttons also are created at the plugin startup and kept while you go to
different file type buffers.

6.21. Map 'r'
*vimrplugin_map_r*
If the variable vimrplugin_map_r exists, the plugin will map the letter 'r'
to send lines to R when there are visually selected lines, for compatibility
with the original plugin. To activate this option, insert the following into
vimrc:

   let vimrplugin_map_r = 1

You may want to add the following three lines to your vimrc which were in
Johannes Ranke's plugin and will increase compatibility with code edited with
Emacs:

   set expandtab
   set shiftwidth=4
   set tabstop=8

6.22. Add ^A^K to the beginning of commands
*vimrplugin_ca_ck*
When one types <C-a> in the R Console the cursor goes to the beginning of the
line and when one types <C-k> the characters to the right of the cursor are
deleted. This is useful to avoid characters left on the R Console being mixed
with commands sent by Vim. However, sending <C-a> may be problematic if using
Tmux. The Vim-R-plugin will add <C-a><C-k> to every command if you put
in your vimrc:

   let vimrplugin_ca_ck = 1

6.23. Open PDF after processing rnoweb, rmd or rrst files
*vimrplugin_openpdf*
*vimrplugin_openpdf_quietly*
*vimrplugin_openhtml*
The plugin can automatically open the pdf file generated by pdflatex, after
either Sweave() or knit(). This behavior is controlled by the variable
vimrplugin_openpdf whose value may be 0 (do not open the pdf), 1 (open only
the first time that pdflatex is called) or a number higher than 1 (always
open the pdf). For example, if you want that the pdf application is started
automatically but do not want the terminal (or GVim) losing focus every time
that you generate the pdf, you should put in put in your vimrc:

   let vimrplugin_openpdf = 1

If you use Linux or other Unix and eventually use the system console (without
the X server) you may want to put in your vimrc:

   if $DISPLAY != ""  let vimrplugin_openpdf = 1  endif Note: If the pdf is already open, some pdf readers will automatically update the pdf; others will lock the pdf file and prevent R from successfully compiling it again. The application used to open the pdf may not be the same when the pdf is open by R (when vimrplugin_openpdf = 1) and when you open it manually with <LocalLeader>op key binding. If you are using Linux/Unix, you can change the pdf reader by setting the value of the environment variable$R_PDFVIEWER. This
will affect both Vim and R.

On Linux/Unix, when vimrplugin_openpdf = 1, the application used to open the
pdf may be quite verbose, printing many lines of useless diagnostic messages
in the R Console. Put the following in your vimrc to inhibit these messages
(and all useful error messages):

   let vimrplugin_openpdf_quietly = 1

If editing an Rmd file, you can produce the html result with <LocalLeader>kh.
The html file will be automatically opened if you put the following in your
vimrc:

   let vimrplugin_openhtml = 1

6.24. Support to RreStructuredText file
*vimrplugin_strict_rst*
*vimrplugin_rst2pdfpath*
*vimrplugin_rst2pdfargs*
*vimrplugin_rrstcompiler*
By default, the Vim-R-plugin sends the command render_rst(strict=TRUE) to R
before using R's knit() function to convert an Rrst file into an rst one. If
you prefer the non strict rst code, put the following in your vimrc:

   let vimrplugin_strict_rst = 0

You can also set the value of vimrplugin_rst2pdfpath (the path to rst2pdf
application), vimrplugin_rrstcompiler (the compiler argument to be passed to R
function knit2pdf), and vimrplugin_rst2pdfargs (further arguments to be passed
to R function knit2pdf).

6.25. Allow R commands in insert mode
*vimrplugin_insert_mode_cmds*
Vim-R commands are designed to work in insert mode as well as normal mode.
However, depending on your <LocalLeader>, this can make it very difficult to
write R packages or Sweave files.  For example, if <LocalLeader> is set to the
\ character, typing \dQuote in a .Rd file tries to send the command!

The option vimrplugin_insert_mode_cmds disables commands in insert mode.  To
use it, add the following to your vimrc:

   let g:vimrplugin_insert_mode_cmds = 0

The default value is 1, for consistency with earlier versions.

6.26. Show/remove hidden objects
*vimrplugin_allnames*
*vimrplugin_rmhidden*
Hidden objects are not included in the list of objects for omni completion. If
you prefer to include them, put in your vimrc:

   let g:vimrplugin_allnames = 1

Hidden objects are removed from R workspace when you do <LocalLeader>rm. If
you prefer to remove only visible objects, put in your vimrc:

   let g:vimrplugin_rmhidden = 0

6.27. Source additional scripts
*vimrplugin_source*
This variable should contain a comma separated list of Vim scripts to be
sourced by the Vim-R-plugin. These scripts may provide additional
functionality and/or change the behavior of the Vim-R-plugin. If you have such
scripts, put in your vimrc:

   let vimrplugin_source = "~/path/to/MyScript.vim,/path/to/AnotherScript.vim"

Currently, there are only two scripts known to extend the Vim-R-plugin
features:

   Support to the devtools R package
https://github.com/mllg/vim-devtools-plugin

   Basic integration with GNU screen
https://github.com/jalvesaq/screenR

6.28. Restart R if it is already running (Linux/Unix only)
*vimrplugin_restart*
When R is already running and you type one of the commands to start R before
you have done <LocalLeader>rq, the Vim-R-plugin does one of the following:
(a) If R is in an external terminal emulator, the terminal is closed, a new
one is opened with the same R session running in it. (b) If both Vim and R are
running in different Tmux regions of the same terminal emulator, the plugin
warns that R is already running.

If instead of the default behavior, you prefer to quit and restart R when you
do <LocalLeader>rf, <LocalLeader>rv or <LocalLeader>rc, then, put in your
vimrc:

   let vimrplugin_restart = 1

6.29. Show extra information during omnicompletion
*vimrplugin_show_args*
If you want that Vim shows a preview window with the function arguments as you
do omnicompletion, put in your vimrc:

   let vimrplugin_show_args = 1

The preview window is not shown by default because it is more convenient to
run <Ctrl-X><Ctrl-A> to complete the function arguments. The preview window
will be shown only if "preview" is also included in your 'completeopt'.

6.30. Time to wait for vimcom loading
*vimrplugin_vimcom_wait*
The Vim-R-plugin waits 5000 milliseconds for vimcom package to be loaded
during R startup. It then checks whether you are using the correct version of
vimcom. On Unix, it also sends a message to R update the list of uploaded
libraries and, then, immediately updates the syntax highlighting of function
names. If 5000 milliseconds is not enough to your R startup, then set a higher
value for the variable in your vimrc. Example:

   let vimrplugin_vimcom_wait = 10000

Note: You should have the line  library(vimcom)  in your Rprofile. The
Vim command  :RpluginConfig  adds that line for you.

The plugin has a different behavior with Neovim: it receives a message from
vimcom as soon as it is loaded and warns if the package was not loaded
after 15 seconds of sending the command to start R. If you need more than 15
seconds, change the value of vimrplugin_vimcom_wait.

If you do not want to install the vimcom package, then put in your
vimrc:

   let vimrplugin_vimcom_wait = -1

6.31 Start R in working directory of Vim
*vimrplugin_vim_wd*
The Vim-R-plugin starts R in the directory where the current buffer is. If you
want R's working directory to be the same as Vim's working directory, put in
your vimrc:

    let vimrplugin_vim_wd = 1

This option is useful only for those who did not enable 'autochdir'.

--------------------------------------------------------
*r-plugin-key-bindings*
7. Custom key bindings

When creating custom key bindings for the Vim-R-plugin, it is necessary to
create three maps for most functions because the way the function is called is
different in each Vim mode. Thus, key bindings must be made for Normal mode,
Insert mode, and Visual mode.

To customize a key binding you should put in your vimrc something like:

   nmap <LocalLeader>sr <Plug>RStart
   imap <LocalLeader>sr <Plug>RStart
   vmap <LocalLeader>sr <Plug>RStart

The above example shows how to change key binding used to start R from
<LocalLeader>rf to <LocalLeader>sr.

Only the custom key bindings for Normal mode are shown in Vim's menu, but you
can type :map to see the complete list of current mappings, and below is the
list of the names for custom key bindings (the prefix RE means "echo";
RD, "cursor down"; RED, both "echo" and "down"):

   Star/Close R
RStart
RVanillaStart
RCustomStart
RClose
RSaveClose

   Clear R console
RClearAll
RClearConsole

   Edit R code
RSimpleComment
RSimpleUnComment
RToggleComment
RRightComment
RCompleteArgs
RIndent

   Send line or part of it to R
RSendLine
RDSendLine
RSendLAndOpenNewOne
RNLeftPart
RNRightPart
RILeftPart
RIRightPart
RDSendLineAndInsertOutput

   Send code to R console
RSendSelection
RESendSelection
RDSendSelection
REDSendSelection
RSendMBlock
RESendMBlock
RDSendMBlock
REDSendMBlock
RSendParagraph
RESendParagraph
RDSendParagraph
REDSendParagraph
RSendFunction
RESendFunction
RDSendFunction
REDSendFunction
RSendFile
RESendFile

   Send command to R
RHelp
RPlot
RSPlot
RShowArgs
RShowEx
RShowRout
RObjectNames
RObjectPr
RObjectStr
RSetwd
RSummary
RListSpace

   Support to Sweave and knitr
RSendChunk
RDSendChunk
RESendChunk
REDSendChunk
RSendChunkFH (from the first chunk to here)
RBibTeX    (Sweave)
RBibTeXK   (Knitr)
RSweave
RKnit
RMakeHTML
RMakeODT
RMakePDF   (Sweave)
RMakePDFK  (Knitr)
RMakePDFKb (.Rmd, beamer)
ROpenPDF
RSpinFile
RMakeSlides (Slidify)

   Object browser
RUpdateObjBrowser
ROpenLists
RCloseLists

The completion of function arguments only happens in Insert mode. To customize
its keybind you should put in your vimrc something as in the example:

   imap <C-A> <Plug>RCompleteArgs

The plugin also contains a function called RAction which allows you to build
ad-hoc commands to R. This function takes the name of an R function such as
"levels" or "table" and the word under the cursor, and passes them to R as a
command.

For example, if your cursor is sitting on top of the object called gender and
you call the RAction function, with an argument such as levels, Vim will pass
the command levels(gender) to R, which will show you the levels of the
object gender. To make it even easier to use this and other functions, you
could write custom key bindings in your vimrc, as in the examples below:

   map <silent> <LocalLeader>rk :call RAction("levels")<CR>
   map <silent> <LocalLeader>t :call RAction("tail")<CR>
   map <silent> <LocalLeader>h :call RAction("head")<CR>

If the command that you want to send does not require an R object as argument,
you can create a shortcut to it by following the example:

   map <silent> <LocalLeader>s :call g:SendCmdToR("search()")

--------------------------------------------------------
*r-plugin-files*
8. License and files

The Vim-R-plugin is free software; you can redistribute it and/or modify it
Software Foundation; either version 2 of the License, or (at your option) any
later version.

The Vim-R-plugin is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
details.

A copy of the GNU General Public License is available at

The files released with Vim runtime files are distributed under the Vim

The following files are part of the plugin and should be in your ~/.vim
directory after the installation:

ftdetect/r.vim
indent/r.vim
indent/rmd.vim
indent/rrst.vim
indent/rnoweb.vim
indent/rhelp.vim
ftplugin/r.vim
ftplugin/r_rplugin.vim
ftplugin/rbrowser.vim
ftplugin/rdoc.vim
ftplugin/rhelp.vim
ftplugin/rhelp_rplugin.vim
ftplugin/rmd.vim
ftplugin/rmd_rplugin.vim
ftplugin/rrst.vim
ftplugin/rrst_rplugin.vim
ftplugin/rnoweb.vim
ftplugin/rnoweb_rplugin.vim
syntax/rout.vim
syntax/r.vim
syntax/rhelp.vim
syntax/rmd.vim
syntax/rrst.vim
syntax/rdoc.vim
syntax/rbrowser.vim
doc/r-plugin.txt
r-plugin/vimcom.py
r-plugin/nvimcom.py
r-plugin/nvimserver.py
r-plugin/global_r_plugin.vim
r-plugin/windows.py
r-plugin/tex_indent.vim
r-plugin/r.snippets
r-plugin/common_buffer.vim
r-plugin/common_global.vim
r-plugin/vimrconfig.vim

--------------------------------------------------------
*r-plugin-tips*
9. FAQ and tips

9.1. Is it possible to stop R from within Vim?

Sorry, it is not possible. The plugin can only send the quit() command. If you
want to stop R, you have to press ^C into R's Console.

9.2. Html help and custom pager

If you prefer to see help pages in an html browser, put in your ~/.Rprofile:

   options(help_type = "html")

and in your vimrc (see vimrplugin_vimpager):

   let vimrplugin_vimpager = "no"

9.3. How do marked blocks work?
*r-plugin-showmarks*
Vim allows you to put several marks (bookmarks) in buffers. The most commonly
used marks are the lowercase alphabet letters. If the cursor is between any
two marks, the plugin will send the lines between them to R if you press
<LocalLeader>bb. If the cursor is above the first mark, the plugin will send
from the beginning of the file to the mark. If the cursor is below the last
mark, the plugin will send from the mark to the end of the file. The mark
above the cursor is included and the mark below is excluded from the block to
be sent to R. To create a mark, press m<letter> in Normal mode.

We recommended the use of ShowMarks plugin which show what lines have marks
defined. The plugin is available at:

http://www.vim.org/scripts/script.php?script_id=152

You may want to add the following two lines to your vimrc to customize
ShowMarks behavior:

   let marksCloseWhenSelected = 0
   let showmarks_include = "abcdefghijklmnopqrstuvwxyz"

9.4. Use snipMate
*r-plugin-snippets*
You probably will want to use the snipMate plugin to insert snippets of code

http://www.vim.org/scripts/script.php?script_id=2540

The snipMate plugin does not come with snippets for R, but you can copy the
files r.snippets and rmd.snippets that ship with the Vim-R-plugin (look at the
r-plugin directory) to the snippets directory. The files have only a few
snippets, but they will help you to get started. If you usually edit rnoweb
files, you may also want to create an rnoweb.snippets by concatenating both
tex.snippets and r.snippets. If you edit R documentation, you may want to
create an rhelp.snippets

9.5. Easier key bindings for most used commands
*r-plugin-bindings*
The most used commands from Vim-R-plugin probably are "Send line" and "Send
selection". You may find it a good idea to map them to the space bar in your
vimrc (suggestion made by Iago Mosqueira):

   vmap <Space> <Plug>RDSendSelection
   nmap <Space> <Plug>RDSendLine

You may also want to remap <C-x><C-o>:

http://stackoverflow.com/questions/2269005/how-can-i-change-the-keybinding-used-to-autocomplete-in-vim

Note: Not all mappings work in all versions of Vim. Some mappings may not work
on GVim on Windows, and others may not work on Vim running in a terminal
emulator or in Linux Console. The use of <Shift>, <Alt> and <Fn> keys in
mappings are particularly problematic. See:

https://github.com/jcfaria/Vim-R-plugin/issues/111

9.6. Remap the <LocalLeader>
People writing Rnoweb documents may find it better to use a comma or other key
as the <LocalLeader> instead of the default backslash (see maplocalleader).
For example, to change the <LocalLeader> to a comma, put at the beginning of
your vimrc (before any mapping command):

   let maplocalleader = ","

9.7. Use a tags file to jump to function definitions
*r-plugin-tagsfile*
Vim can jump to a function definition if it finds a "tags" file with the
information about the place where the function is defined. To generate the
tags file, use the R function rtags(), which will build an Emacs tags file.
If Vim was compiled with the feature emacs_tags, it will be able to read the
tags file. Otherwise, you can use the vimcom function etags2ctags() to
convert the Emacs tags file into a Vim's one. To jump to a function
definition, put the cursor over the function name and hit CTRL-]. Please, read
tagsrch for details on how to use tags files, specially the section
tags-option.

You could, for example, download and unpack R's source code, start R inside
the ~/.vim directory and do the following commands:

   rtags(path = "/path/to/R/source/code", recursive = TRUE, ofile = "RTAGS")
   etags2ctags("RTAGS", "Rtags")

Then, you would quit R and do the following command in the terminal emulator:

   ctags --languages=C,Fortran,Java,Tcl -R -f RsrcTags /path/to/R/source/code

Finally, you would put the following in your vimrc, optionally inside an
autocmd-group:

   autocmd FileType r set tags+=~/.vim/Rtags,~/.vim/RsrcTags
   autocmd FileType rnoweb set tags+=~/.vim/Rtags,~/.vim/RsrcTags

Note: While defining the autocmd, the Rtags path must be put before RsrcTags.

Example on how to test whether your setup is ok:

1. Type mapply() in an R script and save the buffer.
3. Locate the string "do_mapply", which is the name of a C function.

9.8. Indenting setup
*r-plugin-indenting*
Note: In Normal mode, type == to indent the current line and gg=G to format
the entire buffer (see gg, = and G for details). These are Vim commands;
they are not specific to R code.

The Vim-R-plugin includes a script to automatically indent R files. By
default, the script aligns function arguments if they span for multiple lines.
If you prefer do not have the arguments of functions aligned, put in your
vimrc:

   let r_indent_align_args = 0

By default, all lines beginning with a comment character, #, get the same
indentation level of the normal R code. Users of Emacs/ESS may be used to have
lines beginning with a single # indented in the 40th column, ## indented as R
code, and ### not indented. If you prefer that lines beginning with comment
characters are aligned as they are by Emacs/ESS, put in your vimrc:

   let r_indent_ess_comments = 1

If you prefer that lines beginning with a single # are aligned at a column
different from the 40th one, you should set a new value to the variable
r_indent_comment_column, as in the example below:

   let r_indent_comment_column = 30

By default any code after a line that ends with "<-" is indented. Emacs/ESS
does not indent the code if it is a top level function. If you prefer that the
Vim-R-plugin behaves like Emacs/ESS in this regard, put in your vimrc:

   let r_indent_ess_compatible = 1

Below is an example of indentation with and without this option enabled:

   ### r_indent_ess_compatible = 1           ### r_indent_ess_compatible = 0
   foo <-                                    foo <-
       function(x)                               function(x)
   {                                             {
       paste(x)                                      paste(x)
   }                                             }

Notes: (1) Not all code indented by Emacs/ESS will be indented by the
Vim-R-plugin in the same way, and, in some circumstances it may be
necessary to make changes in the code to get it properly indented
by Vim (you may have to either put or remove braces and line
breaks).
(2) Indenting is not a file type plugin option. It is a feature defined
in indent/r.vim. That is why it is documented in this section.

9.9. Folding setup
*r-plugin-folding*
Vim has several methods of folding text (see fold-methods and
fold-commands). To enable the syntax method of folding for R files, put in
your vimrc:

   let r_syntax_folding = 1

With the above option, Vim will load R files with all folds closed. If you
prefer to start editing files with all folds open, put in your vimrc:

   set nofoldenable

Notes: (1) Enabling folding may slow down Vim. (2) Folding is not a file type
plugin option. It is a feature defined in syntax/r.vim.

Note: Indentation of R code is very slow because the indentation algorithm
sometimes goes backwards looking for an opening parenthesis or brace or for
the beginning of a for, if or while statement. This is necessary because
the indentation level of a given line depends on the indentation level of the
previous line, but the previous line is not always the line above. It's the
line where the statement immediately above started. Of course someone may
develop a better algorithm in the future.

9.10. Highlight chunk header as R code

By default, Vim will highlight chunk headers of RMarkdown and
RreStructuredText with a single color. When the code is processed by knitr,
chunk headers should contain valid R code and, thus, you may want to highlight
them as such. You can do this by putting in your vimrc:

   let rrst_syn_hl_chunk = 1
   let rmd_syn_hl_chunk = 1

9.11. Automatically close parenthesis

Some people want Vim automatically inserting a closing parenthesis, bracket or
brace when an open one has being typed. The page below explains how to achieve
this goal:

http://vim.wikia.com/wiki/Automatically_append_closing_characters

9.12. Automatic line breaks

By default, while editing R code, Vim does not break lines when you are typing
if you reach the column defined by the 'textwidth' option. If you prefer that
Vim breaks the R code automatically put in your vimrc:

   autocmd FileType r setlocal formatoptions+=t

9.13. Vim with 256 colors in a terminal emulator (Linux/Unix only)

If you want 256 colors support in Vim, install the package ncurses-term. Then
put in your ~/.bashrc the lines suggested at r-plugin-bash-setup.
Finally, put in your vimrc:

   if &term =~ "xterm" | &term =~ "256" | $DISPLAY != ""  set t_Co=256  endif  colorscheme your_preferred_color_scheme You have to search the internet for color schemes supporting 256 colors, download and copy them to ~/.vim/colors. You may use the command :colorscheme to try them one by one before setting your preference in your vimrc. 9.14. Run your Makefile from within R Do you have many Rnoweb files included in a master tex or Rnoweb file and use a Makefile to build the pdf? You may consider it useful to put the following line in your vimrc:  nmap <LocalLeader>sm :update<CR>:call g:SendCmdToR('system("make")')<CR> 9.15. Edit your ~/.Rprofile *r-plugin-Rprofile* You may want to edit your ~/.Rprofile in addition to considering the suggestions of r-plugin-R-setup you may also want to put the following lines in your .Rprofile if you are using Linux:  grDevices::X11.options(width = 4.5, height = 4, ypos = 0,  xpos = 1000, pointsize = 10) The X11.options() is used to choose the position and dimensions of the X11 graphical device. You can also install the application wmctrl and create shortcuts in your desktop environment to the commands  wmctrl -r "R Graphics" -b add,above  wmctrl -r "R Graphics" -b remove,above which will toggle the "always on top" state of the X11 device window. Alternatively, you can right click on the X11 device window title bar and choose "Always on top". This is useful to emulate a feature present in R IDEs which can display R plots in a separate panel. Although we can not embed an R graphical device in Vim, we can at least make it always visible over the terminal emulator or the GVim window. 9.16. Debugging R functions The Vim-R-Plugin does not have debugging facilities, but you may want to use the R package "debug":  install.packages("debug")  library(debug)  mtrace(function_name) Once the library is installed and loaded, you should use mtrace(function_name) to enable the debugging of a function. Then, the next time that the function is called it will enter in debugging mode. Once debugging a function, you can hit <Enter> to evaluate the current line, go(n) to go to line n in the function and qqq() to quit the function (See debug's help for details). A useful tip is to click on the title bar of the debug window and choose "Always on top" or a similar option provided by your desktop manager. 9.17. Turn the R-plugin into a global plugin (Linux/Unix only) *r-plugin-global* The Vim-R-plugin is a file type plugin. If you want its functionality available for all file types, then put in your vimrc:  source path/to/Vim-R-plugin/r-plugin/global_r_plugin.vim You will then be able to type <LocalLeader>rf to start and <LocalLeader>rq to quit different command line interpreters and <LocalLeader>d, l, ss, bb, etc to send code to the interpreter. If you want support for a language other than Julia, Python, Haskell, Ruby and Lisp, you have to set the values of vimrplugin_exe and vimrplugin_quit as the example below does for Octave:  let vimrplugin_exe = "octave"  let vimrplugin_quit = "quit" If you use yet another interpreter, you will want to put the commands above in a Vim autocommand:  autocmd BufNewFile,BufRead *.m let vimrplugin_exe = "octave" | let vimrplugin_quit = "quit" If you use GVim, you may also want to set vimrplugin_never_unmake_menu in your vimrc:  let vimrplugin_never_unmake_menu = 1 9.18. Disable syntax highlight of R functions If you want to disable the syntax highlight of R functions put in your vimrc:  autocmd Syntax * syntax clear rFunction 9.19. Tips for knitr users *r-plugin-knitr* If you are using knitr with option cache=TRUE, you may want from time to time to delete all objects in R workspace and all files in the cache directory. If you want to use <LocalLeader>kr in Normal mode for this, put in your vimrc:  nmap <LocalLeader>kr :call g:SendCmdToR('rm(list=ls(all.names=TRUE)); unlink("cache/*")')<CR> When generating pdfs out of Rmd-files, you can send options to pandoc. State them in your vimrc. For example let vimrplugin_pandoc_args = "--toc -V lang=german" will produce a german document with a table of contents. 9.20. Integration with LaTeX-Box *r-plugin-latex-box* LaTeX-Box does not automatically recognize Rnoweb files as a valid LaTeX file. You have to tell LaTeX-BoX that the .tex file compiled by either knitr() or Sweave() is the main LaTeX file. You can do this in two ways. Suppose that your Rnoweb file is called report.Rnw... You can: (1) Create an empty file called "report.tex.latexmain". or (2) Put in the first 5 lines of report.Rnw: % For LaTeX-Box: root = report.tex Of course you must run either knitr() or Sweave() before trying LaTeX-Box omnicompletion. Please, read LaTeX-Box documentation for more information. See also: vimrplugin_latexcmd. 9.21. Quick setup for the Vim-R-plugin on Linux/Unix environment *r-plugin-quick-setup* Please, look at section r-plugin-options if you want information about the Vim-r-plugin customization. Here are some suggestions of configuration of Vim, Bash, Tmux and R. To understand what you are doing, and change the configuration to your taste, please read this document from the beginning.  ~/.vimrc  " Minimum required configuration:  set nocompatible  syntax on  filetype plugin on  filetype indent on  " Change Leader and LocalLeader keys:  let maplocalleader = ","  let mapleader = ";"  " Use Ctrl+Space to do omnicompletion:  if has("gui_running")  inoremap <C-Space> <C-x><C-o>  else  inoremap <Nul> <C-x><C-o>  endif  " Press the space bar to send lines and selection to R:  vmap <Space> <Plug>RDSendSelection  nmap <Space> <Plug>RDSendLine  " The lines below are suggestions for Vim in general and are not  " specific to the improvement of the Vim-R-plugin.  " Highlight the last searched pattern:  set hlsearch  " Show where the next pattern is as you type it:  set incsearch  " By default, Vim indents code by 8 spaces. Most people prefer 4  " spaces:  set sw=4  " Search "Vim colorscheme 256" in the internet and download color  " schemes that supports 256 colors in the terminal emulator. Then,  " uncomment the code below to set you color scheme:  "colorscheme not_defined  " Use 256 colors even if in a terminal emulator:  if &term =~ "xterm" | &term =~ "256" |$DISPLAY != ""
       set t_Co=256
   endif

*r-plugin-bash-setup*
   ~/.bashrc for Vim:

   # Change the TERM environment variable (to get 256 colors) and make Vim
   # connecting to X Server even if running in a terminal emulator (to get
   # dynamic update of syntax highlight and Object Browser):
   if [ "x$DISPLAY" != "x" ]  then  if [ "screen" = "$TERM" ]
       then
           export TERM=screen-256color
       else
           export TERM=xterm-256color
       fi
       alias vim='vim --servername VIM'
       if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]
       then
           function tvim(){ tmux -2 new-session "TERM=screen-256color vim --servername VIM $@" ; }  else  function tvim(){ tmux new-session "vim --servername VIM$@" ; }
       fi
   else
       if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]
       then
           function tvim(){ tmux -2 new-session "TERM=screen-256color vim $@" ; }  else  function tvim(){ tmux new-session "vim$@" ; }
       fi
   fi

   ~/.bashrc for Neovim:

   # Change the TERM environment variable (to get 256 colors):
   if [ "x$DISPLAY" != "x" ]  then  if [ "screen" = "$TERM" ]
       then
           export TERM=screen-256color
       else
           export TERM=xterm-256color
       fi
   fi
   if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]
   then
       function tvim(){ tmux -2 new-session "TERM=screen-256color nvim $@" ; }  else  function tvim(){ tmux new-session "nvim$@" ; }
   fi

*r-plugin-tmux-setup*
   ~/.tmux.conf:

   set-option -g prefix C-a
   unbind-key C-b
   bind-key C-a send-prefix
   # Set "status on" if you usually create new Tmux windows
   set -g status off
   set -g terminal-overrides 'xterm*:smcup@:rmcup@'
   set -g mode-mouse on
   set -g mouse-select-pane on
   set -g mouse-resize-pane on
   # Act more like vim:
   set-window-option -g mode-keys vi
   bind h select-pane -L
   bind j select-pane -D
   bind k select-pane -U
   bind l select-pane -R
   unbind p
   bind p paste-buffer
   bind -t vi-copy v begin-selection
   bind -t vi-copy y copy-selection

*r-plugin-R-setup*
   ~/.Rprofile

   if(interactive()){
       # Get startup messages of three packages and set Vim as R pager:
       options(setwidth.verbose = 1,
               colorout.verbose = 1,
               vimcom.verbose = 1,
               pager = "vimrpager")
       # Use the text based web browser w3m to navigate through R docs:
       if(Sys.getenv("TMUX") != "")
           options(browser="~/bin/vimrw3mbrowser",
                   help_type = "html")
       # Use either Vim or GVim as text editor for R:
       if(nchar(Sys.getenv("DISPLAY")) > 1)
           options(editor = 'gvim -f -c "set ft=r"')
       else
           options(editor = 'vim -c "set ft=r"')
       # Load the colorout library:
       library(colorout)
       if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != ""){
           # Choose the colors for R output among 256 options.
           # You should run show256Colors() and help(setOutputColors256) to
           # know how to change the colors according to your taste:
           setOutputColors256(verbose = FALSE)
       }
       # Load the setwidth library:
       library(setwidth)
       # Load the vimcom library only if R was started by Vim:
       if(Sys.getenv("VIMRPLUGIN_TMPDIR") != ""){
           library(vimcom)
           # See R documentation on Vim buffer even if asking for help in R Console:
           if(Sys.getenv("VIM_PANE") != "")
               options(help_type = "text", pager = vim.pager)
       }
   }

   ~/bin/vimrpager

   #!/bin/sh
   # I don't know the reason, but we can't pipe the output directly to Vim.
   # So we need this script to use 'cat' as intermediary.
   cat | vim -c 'set ft=rdoc' -

   ~/bin/vimrw3mbrowser

   #!/bin/sh
   NCOLS=$(tput cols)  if [ "$NCOLS" -gt "140" ]
   then
       if [ "x$VIM_PANE" = "x" ]  then  tmux split-window -h "w3m$1 && exit"
       else
           tmux split-window -h -t $VIM_PANE "w3m$1 && exit"
       fi
   else
       tmux new-window "w3m 1 && exit"  fi NOTES: 1. The ~/bin diretory must be in your PATH. 2. To use the vimrw3mbrower script the web browser w3m must be installed. 3. You have to change ~/bin/vimrpager and ~/bin/vimrw3mbrowser permissions to make them executable:  chmod +x ~/bin/vimrpager  chmod +x ~/bin/vimrw3mbrowser Finally, if you want to use vi key bindings in Bash:  ~/.inputrc  set editing-mode vi  set keymap vi 9.22. Python versions *r-plugin-python* Are you using Windows and need to use a specific version of either Python or pywin32? The official Vim is 32 bit and, thus, Python must be 32 bit too. However, Vim and R run as independent processes, that is, you may have 32 bit Vim sending commands to 64 bit R. Be careful to download the correct Python version because Vim needs a specific version of Python DLL. For example, the official Vim 7.4 for Windows needs either Python 2.7 or 3.2. If Python was not installed or was not found, the Vim-R-plugin will output information about what Python version Vim was compiled against. Do the following if you want to discover this information manually: 1. Type :version in Vim (normal mode). 2. Look for a string like -DDYNAMIC_PYTHON_DLL="python27.dll". 3. Install the Python version which corresponds to the version which Vim was linked against. In the example of step 2 (python27.dll) the required Python version is 2.7.x. * pywin32: http://sourceforge.net/projects/pywin32/ 9.23. Add tool bar icons and hide unused buttons *r-plugin-toolbar* If you want to add some R buttons to GVim tool bar download the zip file http://www.lepem.ufc.br/jaa/bitmaps.zip and unpack it at either ~/.vim (Unix/Linux/Mac OS X) or ~/vimfiles (Windows). You may not see the buttons because GVim has too many buttons by default. Then, you may want to edit GVim's toolbar and remove the buttons that you never use. Please see the page below to know how to hide buttons on the toolbar: http://vim.wikia.com/wiki/Hide_toolbar_or_menus_to_see_more_text 9.24. Integration with GNU Screen, screen plugin, Conque Shell or VimShell The plugin used to be able to use GNU Screen (through screen plugin), Conque Shell or VimShell to send commands to R. This integration was removed on August 20, 2013. People wanting this integration back into the plugin may want to use the old Vim-R-plugin code as a starting point to create scripts to be sourced by the Vim-R-plugin. Please look at vimrplugin_source for details. -------------------------------------------------------- *r-plugin-news* 10. News 1.0 (2014-07-02) * The package now depends on vimcom (which is fully featured and is no longer on CRAN). * Neovim support. * vimrplugin_openpdf now accepts three values: 0, 1 and 2. * New command \o evaluates current line in R and inserts the output in the script. * New options: vimrplugin_vimcom_wait, vimrplugin_vim_wd, and vimrplugin_tmux_title. * Minor bug fixes. 0.9.9.9 (2014-02-01) * Minor bug fixes. * Delete temporary files on VimLeave event. * Support to R package slidify (thanks to Michael Lerch). * New option: vimrplugin_rcomment_string. 0.9.9.8 (2013-11-30) * The list of objects for omnicompletion and the list of functions for syntax highlight now are built dynamically. Deprecated commands and options: :RUpdateObjList, :RAddLibToList, vimrplugin_buildwait. New option: vimrplugin_permanent_libs. * New options: vimrplugin_show_args. * New command \ch: send to R Console all R code from the first chunk up to this line. * Remove toolbar icons (they still may be added back manually by interested users). * If latexmk is installed, use it by default to compile the pdf. 0.9.9.7 (2013-11-06) * Minor bug fixes. 0.9.9.6 (2013-10-31) * Minor bug fixes. 0.9.9.5 (2013-10-12) * Minor bug fixes. 0.9.9.4 (2013-09-24) * Minor bug fixes. * The package now depends on vimcom.plus. * The support to GNU Screen, VimShell and Conque Shell was dropped. The screen plugin no longer is used. * The delete command was removed from the Object Browser. * New options: vimrplugin_vsplit, vimrplugin_rconsole_height and vimrplugin_rconsole_width. * New option: vimrplugin_restart. * Show elements of S4 objects in the Object Browser. 0.9.9.3 (2013-04-11) * Minor bug fixes. * New option: vimrplugin_source. 0.9.9.2 (2013-02-01) * Update vimcom version requirement to 0.9-7 (fix incompatibility with tcltk package on Unix). * Change the default value of vimrplugin_rmhidden to 0. * New option for Windows: vimrplugin_Rterm. * New simpler un/comment commands: <LocalLeader>xc and <LocalLeader>xu. * Remove options vimrplugin_nosingler and vimrplugin_by_vim_instance. 0.9.9.1 (2012-12-11) * Enable mouse on Tmux again. 0.9.9 (2012-12-03) * New commands: :Rinsert and :Rformat. * Automatically update the Object Browser in GVim. * On MS Windows, don't raise the R Console before sending CTRL-V to it. * Search for vimcom in both IPv4 and IPv6 ports (thanks to Zé Loff for writing the patch). 0.9.8 (2012-10-13) * Open PDF automatically after processing Rnoweb file if vimrplugin_openpdf = 1 (thanks to Tomaz Ficko for suggesting the feature). Open it quietly if vimrplugin_openpdf_quietly = 1. Open it manually with \op. * Open HTML automatically after processing either Rmd or Rrst file if vimrplugin_openhtml = 1. Generate strict rst code if vimrplugin_strict_rst = 1. * Remove option vimrplugin_knitargs. * Start last R if there is more than one installed on Windows (thanks to Alex Zvoleff for reporting the bug and writing the patch). * Alex Zvoleff added support to Rrst file type. * michelk added support to Rmd file type. * For Rnoweb, Rmd and Rrst file types, CTRL-X CTRL-A completes knitr chunk options if the cursor is inside the chunk header. * New option: vimrplugin_rmhidden. * New option: vimrplugin_insert_mode_cmds (thanks to Charles R. Hogg III). * New command :RAddLibToList to add the objects of specific libraries to omnicompletion. * Thanks to genrich and NagatoPain for other bug fixes and code improvements. * New option: vimrplugin_assign_map. The option vimrplugin_underscore was renamed to vimrplugin_assign 0.9.7 (2012-05-04) * Use the R package vimcom: - Automatic update of the Object Browser when running R in a Tmux session. - The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and open_list. - New command in normal and visual modes when on the Object Browser: "d" deletes objects and detach libraries. New option: vimrplugin_ob_sleep. * New option, vimrplugin_external_ob, to open the Object Browser in a Tmux pane in the external terminal running R. * New command :Rhelp (thanks for Nir Atias for suggesting the new feature). * Remove the command :RUpdateObjListAll because Vim may not load the syntax file if it is too big. * Add support to knitr package. * New command :RSourceDir. * New key bindings \r<Left> and \r<Right>. * Correctly send selected blocks. 0.9.6 (2011-12-13) * Fix path to R source() command on Windows. * New default value of vimrplugin_vimpager = "tab". * New default value of vimrplugin_objbr_place = "editor,right" * Autocompletion of function arguments with <C-X><C-A>. 0.9.5 (2011-12-07) * Changed the way that blocks are sent to R. * Added "terminal" to the list of known terminal emulators (thanks for "i5m" for the patch). * Use Tmux to start the Object Browser beside the R console if vimrplugin_objbr_place =~ "console". * The file r-plugin/omniList was renamed to r-plugin/omnils because its field separator changed. 111114 (2011-11-14) * Changed key binding for commenting/uncommenting code from \cc to \xx. * Added function SendChunkToR() and its corresponding key bindings: \cc, \ce, \cd and \ca (thanks to Xavier Fernández i Marín for suggesting the feature). * New option (vimrplugin_ca_ck) was created to fix bug reported by Xavier Fernández i Marín: spurious ^A^K being added to lines sent to R. * Don't blink the menu and toolbar buttons when doing omni completion. * Use Tmux to run R in an external terminal emulator. 111014 (2011-10-14) * Fixed spell check bug in R documentation files (.Rd). * Fixed beep bug when sending commands to R. * New option: vimrplugin_notmuxconf. * Fixed bug when starting tmux before vim: the environment variable VIMRPLUGIN_TMPDIR was not being set. Thanks to Michel Lang for reporting the bug and helping to track its source, and thanks to Eric Dewoestine for explaining how to fix the bug. * Fixed bug in code indentation after unbalanced brackets and parenthesis when r_indent_align_args = 0 (thanks to Chris Neff and Peng Yu for reporting the bugs). * Really make the use of AppleScript the default on OS X (thanks for Jason for reporting the bug). 110805 (2011-08-05) * New option: vimrplugin_tmux. * Set Tmux as the default instead of either GNU Screen or Conque Shell. * Document Tmux as the preferred way of running the plugin on Linux. * Vim-LaTeX-suite plugin can be used with Rnoweb files without any additional configuration. The necessary code was added to the ftplugin/rnoweb.vim. * Added count argument to normal mode commands gn and gN (thanks to Ivan Bezerra for the suggestion). 110614 (2011-06-14) * When doing the command \rh, the plugin tries to show the help for the method corresponding to the class of the object passed as argument to the function. The same with \rp (thanks to Thomas Scheike for suggesting the feature). * Removed script rpager.sh. * Added script global_r_plugin.vim to allow the use of the plugin with any file type. 110222 (2011-02-22) * Added syntax/rhelp.vim. * New command for rnoweb files: BibTeX current file (\sb). * New commands for the object browser: open visible lists (\r=) and close visible lists (\r-). * Reorganization of the GUI menu. 110208 (2011-02-08) * Fixed bug in "else if" constructions (thanks to Dan Kelley for reporting the bug). * Support for commenting/uncommenting lines. 110203 (2011-02-03) * Fixed bug in :RUpdateObjList when the function arguments included S4 objects (thanks to Gerhard Schoefl for reporting the bug). * Improvements in indentation of R code (thanks to Dan Kelley for finding and reporting indentation bugs and testing many versions of indent/r.vim). * New indentation options: r_indent_align_args, r_indent_ess_comments, r_indent_comment_column, and r_indent_ess_compatible. * New file: indent/rhelp.vim. 110117 (2011-01-17) * Fixed indentation bug in Rnoweb files (thanks to Dan Kelley for reporting the bug). 101217 (2010-12-17) * Renamed the function SendCmdToScreen to SendCmdToR. * Clear the current line in the R console before sending a new line. * Always starts R on the script's directory. * Don't send "^@" as part of a paragraph in rnoweb files (thanks to Fabio
Correa for reporting the bug).
* More useful warning message when PyWin32 isn't installed.
* Initial support to AppleScript on Mac OS X (thanks to Vincent Nijs for
writing and testing the code).

101121 (2010-11-21)
* Fix for when whoami returns domain name on Windows (thanks to "Si" for
fixing the bug).

101118 (2010-11-18)
* New command:  :RUpdateObjListAll.
* New option: vimrplugin_allnames.
* Allow the use of Python 3.1 on Windows.
* Minor improvements in indentation of R code.
* The file r-plugin/omni_list was renamed to r-plugin/omniList because its
field separator changed to ";".
* Fixed bug that was causing ^H to be exhibited in the R documentation in
some systems. (Thanks to Helge Liebert for reporting the problem).

101107 (2010-11-07)
* New feature: complete chunk block when '<' is pressed in rnoweb files.
* New option: vimrplugin_rnowebchunk.
* New key bindings in Normal mode for Rnoweb files: gn (go to next R code
chunk) and gN (go to previous R code chunk).
* New command:  :RBuildTags.
* Added fold capability to syntax/r.vim.
* Improved indentation of rnoweb files: thanks to Johannes Tanzler for
writing the tex.vim indent script and for permitting its inclusion in the
Vim-R-plugin.
* R CMD BATCH now is called with --no-restore --no-save (key binding \ro).
* The file r-plugin/omnilist now has an additional field and was renamed as
omni_list.
* Use 64 bit version of R by default on Windows if the directory bin/x64
exists.
* New Windows only option: vimrplugin_i386.

101025 (2010-10-25)
* New option: vimrplugin_routmorecolors.
* Fixed bug in the Object Browser when a data.frame or list had just one
element (thanks to Jan Larres for reporting the bug).
* Do not copy omnilist and functions.vim to ~/.vim/r-plugin if the directory
where the plugin is installed is writable (thanks to Jan Larres for the
suggestion).

101023 (2010-10-23)
* New options: vimrplugin_objbr_place and vimrplugin_objbr_w.
* New default value: vimrplugin_vimpager = "vertical"
* The R help can now be seen in a Vim buffer on MS Windows.
* Fix width of help text when R version >= 2.12.0.
* Implemented actions in the Object Browser: summary, print, etc...
* Browse libraries objects in Object Browser.

101016 (2010-10-16)
* Minor bug fixes in the Object Browser.

101015 (2010-10-15)
* New feature: Object Browser.
* Conque Shell will be used if installed unless explicitly told otherwise in
the vimrc.
* New valid value for vimrplugin_vimpager: "tabnew"

100923 (2010-09-23)
* New option: vimrplugin_vimpager.
* Do not let Vim translate "File" in R menu.
* Fixed bug when the option vimrplugin_r_path was used (thanks to Asis Hallab
for reporting the bug),
* Fixed bug (E687) when user created custom key binding (thanks to Philippe
Glaziou for reporting the bug).

100917 (2010-09-17)
* Changed the use of vimrplugin_r_path: now the option includes only the
directory part of the path.
* Initial support to Conque Shell plugin. Thanks to "il_principe orange" for
suggesting the use of Conque Shell, "ZyX-I" for writing the initial code to
use Conque Shell, and Nico Raffo for writing the plugin and additional code
to integrate both plugins.
* New options: vimrplugin_conqueplugin and vimrplugin_conquevsplit.
* New option: vimrplugin_r_args.
* Fixed bug when the plugin was installed in a directory other than ~/.vim
* Initial support for Vim-R communication on Windows using Python.

100825 (2010-08-25)
* Minor improvements in syntax highlighting.
* New option: vimrplugin_buildwait.
* New option: vimrplugin_r_path (thanks to Asis Hallab).

100803 (2010-08-03)
* Fixed bug in .Rsource name making in some systems.

100801 (2010-08-01)
* Dropped options vimrplugin_hstart and vimrplugin_browser_time.
* Minor bug fixes.

100730 (2010-07-30)
* Added menu item and key binding for run "R CMD BATCH" and open the
resulting ".Rout" file.
* Fixed bug when more than one Vim instance used the same file to send
multiple lines of code to R (thanks to Bart for reporting the bug).

100728 (2010-07-28)
* Adapted the plugin to allow the creation of a Debian package.

100719 (2010-07-19)
* Added options vimrplugin_listmethods and vimrplugin_specialplot.
* Improved syntax highlight of R batch output (.Rout files).
* No longer uses the external programs grep, awk and sed to build the
additional syntax file containing the list of functions.

100710 (2010-07-10)
* Fixed :RUpdateObjList bug when list had length 0.

100707 (2010-07-07)
* Fixed 'E329: No menu "R"' when more than one file were loaded simultaneously
by calling vim with either -p or -o parameters. Thanks to Peng Yu for
reporting the bug.
* Correctly recognize a newly created file with extension ".R" as an R script
file.

100521 (2010-05-12)
* Replaced "-t" with "--title" to make xfce4-terminal work again.

100512 (2010-05-12)
* Thanks to Tortonesi Mauro who wrote a patch to make the plugin work with
pathogen.vim.
* Added simple syntax highlight for .Rout files.
* Increased the time limit of RUpdateObjList to two minutes.
* Improvement in the syntax highlight based on code written by Zhuojun Chen.
* Thanks to Scott Kostyshak who helped to improve the documentation.
* Iago Mosqueira suggested that the plugin should be able to run one R process
for each Vim instance, and his suggestion was implemented with the option
vimrplugin_by_vim_instance.

091223 (2009-12-23)
* Syntax highlight for R functions.
* Added "info" field to omni completion (thanks to Ben Kujala for writing the
original code).

091016 (2009-10-16)
* The plugin now can run together with screen.vim, thanks to Eric Van
Dewoestine, the author of screen.vim, who added script integration to
screen.vim.
* Andy Choens has made many improvements on the documentation.
* Added the possibility of custom key binding creation to call any R function
with the word under cursor as argument.
* The key bindings related with Sweave are activated even if the file type is
not rnoweb.
* Replaced <Leader> with <LocalLeader> in the key bindings.

091004 (2009-10-04)
* Jose Claudio Faria has begun to work in the project as co-author.
* Some ideas from Tinn-R project were ported to the plugin.
* The main menu has new items and the toolbar new icons.
* Documentation improvements.

090828 (2009-08-28)
* Faster startup.
* Better support for Rnoweb files: the cursor goes to '^<<' if the sent line
is '^@\$'.

090811 (2009-08-12)
* Now use screen instead of funnel.pl. The bugs and limitations related with
funnel.pl are solved.
* Deleted key binding for R-devel.
* Automatically detect available terminal emulators and choose one of them.
* By default, no longer calls help.start() the first time that CTRL-H is
pressed.

090810 (2009-08-10)
* Added R icons for some terminal emulators.
* Removed the script open-gvim-here. You may use Vim's option autochdir.
* Improved indentation script.
* Changed key binding from Shift-Enter, which doesn't work in any terminal, to
Alt-Enter, which at least works in xterm.

090610 (2009-06-11)
* The options expandtab, shiftwidth and tabstop are no longer set by the plugin.
* Better word detection before calling R's help().
* Fixed bug in underscore replacement.
* Fixed small bug in code indentation.
* Added two new plugin options: no underscore replacement and fixed name for
the pipe file instead of random one.

090523 (2009-05-23)
* Key bindings now are customizable.
* Default key binding for calling R's args() changed to Shift-F1.
* New R script rargs.R gives better results for generic functions than R's
args() called directly.

090519 (2009-05-20)
* Don't send large blocks of code to R to avoid xterm freezing.
* Automatically call help.start() after CTRL-H is pressed for the first time,
and wait 4 seconds for the browser start before calling R's help(). These
features are customizable.
* Fixed tags file script.

090516 (2009-05-16)