# jcfaria/Vim-R-plugin forked from vim-scripts/Vim-R-plugin

Fetching contributors…
Cannot retrieve contributors at this time
2381 lines (2014 sloc) 95.6 KB
 *r-plugin.txt* *vim-r-plugin* Vim-R-plugin~ Plugin to work with R~ Authors: Jakson A. Aquino Jose Claudio Faria Version: 0.9.8 For Vim version 7.3 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| 8. Files |r-plugin-files| 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 and feature requests to the developers; we are very interested in what you like and what you would like to see in future releases. Do not like a feature? Tell us and we may add an option to disable it. Cryptic error message are bugs... Please report them. The plugin should emit useful warnings if you do things it was not programmed to deal with. ============================================================================== *r-plugin-features* 2. Main features~ * Syntax highlighting for R code, including: - Special characters in strings. - Functions of all installed packages (must be updated manually). - 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 and pdflatex commands. * Omni completion (auto-completion) for R objects (.GlobalEnv and installed packages). The list of installed packages must be updated manually. * 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 formating of the text to fit the panel width. - Send code and commands to R (useful to run examples). - Jump to another R documentation. - 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) general instructions for all operating systems; (2) instructions that are specific for either Unix/Linux/OSX or Windows; (3) troubleshooting; and (4) optional steps. 3.1. General instructions I~ Note: Most of the plugin commands require that you type the which is '\' by default. You need to activate plugins and indentation according to 'filetype'. You should have at least the following options in your |vimrc|: > set nocompatible syntax enable filetype plugin on filetype indent on < Make a backup of your ~/.vim directory because existing files will be replaced. Please, look at |r-plugin-files| to see the list of files. 3.2. Operating system specific instructions~ 3.2.1. Unix (Linux, OS X, etc.)~ Uncompress the archive: > unzip vim-r-plugin-*.zip -d ~/.vim < Start Vim and build the tags file for this document (and others that eventually are in the same directory): > :helptags ~/.vim/doc < Note: If you are using Mac OS X and prefer that Vim uses AppleScript to send commands to R, then the installation is finished and you should now read sections 3.3 and 3.4. In addition to having R installed in your system, this plugin has the following dependencies: Depends:~ Vim >= 7.3 with Python support. Tmux >= 1.5: http://tmux.sourceforge.net Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 vimcom >= 0.9-3: An R package. Suggests:~ ncurses-term: http://invisible-island.net/ncurses colorout: An R package. setwidth: An R package. Note: Tmux and ncurses-term are already packaged for most GNU/Linux distributions and other Unix variants. The library ncurses-term is necessary only for 256 color support in the terminal emulator. Unfortunately their installation instructions vary widely and are beyond the scope of this documentation. The vimcom package creates a server on R to allow the communication with Vim. The package is not used to send commands from Vim to R, but it is necessary to open R documentation in Vim's buffer, run the Object Browser, run either Sweave() or knit() on the document being edited. It also has some functions called by Vim such as vim.plot(), vim.print(), and vim.bol(). This last one is required to build the data base used in omnicompletion. The colorout package colorizes the R output and the setwidth package adjusts the value of options("width") whenever the terminal is resized. They can be installed from within R. The colorout package is available at http://www.lepem.ufc.br/jaa/colorout.html while setwidth and vimcom can be installed as usual: > install.packages(c("vimcom", "setwidth")) < You certainly will want to put something like the following at the end of your ~/.Rprofile: > if(interactive()){ library(colorout) library(setwidth) library(vimcom) } < The plugin will run R inside a Tmux session. If you are using Vim (not GVim), you may be interested in reading |r-plugin-tmux| section to learn a few useful shortcuts. The tmux.conf file created by the plugin sets Tmux to work with Vi key bindings, as the escape character and also enables the mouse for Tmux. Note: The plugin can use different mechanisms to send commands to R. The mechanism that will be used depends on both what applications and plugins you have installed and what options you have in your |vimrc|. The two lists below show how the plugin will work on Linux in different conditions: Vim Condition~ ------------------------------ ------------------------------------- Screen plugin (Tmux) default on Linux Screen plugin (GNU Screen) vimrplugin_tmux = 0 or Tmux not found Tmux (external terminal) vimrplugin_screenplugin = 0 GNU Screen (external terminal) vimrplugin_screenplugin = 0 and no Tmux GVim Condition~ ------------------------------ ------------------------------------- Tmux (external terminal) default on Linux GNU Screen (external terminal) vimrplugin_tmux = 0 or Tmux not found Note: On Mac OS X the plugin will use AppleScript in both Vim and GVim unless vimrplugin_applescript = 0. 3.2.2. Windows~ In addition to having R installed in your system, this plugin requires users to install external dependencies: * Vim's version must be >= 7.3 * Python: http://www.python.org/download/ Note: 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. Note: Be careful to download the correct Python version because Vim needs a specific version of Python DLL. For example, the official Vim 7.3 for Windows needs either Python 2.7 or 3.1. 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/ Note: The default download may not match the Python version Vim was linked against. You have to "View all files" on the download page to find the file that matches exactly the version of Python that you installed. * vimcom >= 0.9-3: An R package. You can install it with the R command install.packages("vimcom"). The vimcom package creates a server on R to allow the communication with Vim. You certainly will want to put the following lines at the end of your Rprofile (usually at ~/Documents/.Rprofile): > if(interactive()){ library(vimcom) } < Create your |vimfiles| directory if you do not have it yet. Its path will be similar to one of the following: > C:\Documents and Settings\yourlogin\vimfiles C:\Users\yourlogin\vimfiles < Uncompress the archive. Right click on the plugin's zip file and choose "Extract all". Then choose ~/vimfiles as the destination directory. Start Vim and build the tags file for this document (and others that eventually are in the same directory): > :helptags ~\vimfiles\doc < Start editing an R file with GVim and try to send some lines to R Console. You may have to adjust the value of |vimrplugin_sleeptime|. 3.3. Troubleshooting (if the plugin doesn't work)~ Note: The is '\' by default. The plugin is a |file-type| plugin. It will be active only if you are editing a .R or .Rnw file. The menu items and tool bar buttons will not be visible and the key bindings will not be active while editing either unnamed files or files with name extensions other than .R or .Rnw. If the plugin is active, pressing rf should start R. Look at the ~/.vim (Linux, Unix, OS X) or ~/vimfiles (Windows) directory. Is there a subdirectory named "r-plugin"? If not, then you unpacked the plugin in the wrong place. 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 3.4. General instructions II (optional steps)~ 3.4.1 Update list of objects~ Start R and update the list of objects for omni completion and syntax highlight (see |:RUpdateObjList| for details). 3.4.2 Customize the plugin~ Please, read the section |r-plugin-options|. Emacs/ESS users should read the section Indenting setup (|r-plugin-indenting|) of this document. 3.4.3 Hide unused buttons~ Edit GVim's toolbar and remove the buttons that you never use. The plugin adds some buttons to the toolbar, but you may not see them because GVim has too many buttons by default. 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 3.4.4 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 are particularly interesting. Please read |r-plugin-tips| for details. ============================================================================== *r-plugin-use* 4. Use~ 4.1. Key bindings~ Note: The is '\' by default. Note: It is recommended the use of different keys for and to avoid clashes between filetype plugins and general plugins key binds. See |filetype-plugins| and |maplocalleader|. To use the plugin, open a .R or .Rnw or .Rd file with Vim and type 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 and, in some cases, toolbar buttons. In the list below, the backslash represents the . Not all menu items and key bindings are enabled in all filetypes supported by the plugin (r, rnoweb, rhelp): 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 -------------------------------------------------------- . 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 . Right part of line (cur) \r ----------------------------------------------------------- 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 . Spin (cur file) \ks . Knit and PDF (cur file) \kp . Knit and Beamer PDF (cur file) (Only Rmd) \kl . Knit and PDF (cur file, verbose) (Windows) \kv . Knit, BibTeX and PDF (cur file) (Linux/Unix) \kb -------------------------------------------------------- . 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 -------------------------------------------------------- . Comment/Uncomment (line, sel) \xx . Add/Align right comment (line, sel) \; -------------------------------------------------------- . Go (next R chunk) gn . Go (previous R chunk) gN ----------------------------------------------------------- Syntax . Build omnils (loaded packages) :RUpdateObjList ----------------------------------------------------------- Object Browser . Show/Update \ro . Expand (all lists) \r= . Collapse (all lists) \r- . Toggle (cur) Enter ----------------------------------------------------------- Help (plugin) Help (R) :Rhelp ----------------------------------------------------------- Please see |r-plugin-key-bindings| to learn how to customize the key bindings without editing the plugin directly. After the command 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. Please see |vimrplugin_routnotab| if you prefer that the file is open in a new split window. Note: The command 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_underscore| to disable underscore replacement. When you press 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 rp, that is, while printing an object. For example, if you run the code below and, then, press rh and rp over the two occurrences of summary, the plugin will show different documentations and print different objects 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 inside the chunk header. If R is not running or if it is running but is busy the completion will be based on information saved with the command |:RUpdateObjList|. 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). 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 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 one built by |:RUpdateObjList|. 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). 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 4.3. Omni completion and the highlighting of functions~ *:RUpdateObjList* The plugin adds some features to the default syntax highlight of R code. One such feature is the highlight of R functions. However, only functions that R loads by default are highlighted. To add functions of other libraries, you should do the following: 1. Start R from within Vim. 2. Use R's library() to load the libraries whose functions you want highlighted. 3. Run the following command in Vim's Normal mode: :RUpdateObjList The command :RUpdateObjList in addition to creating a list of function names to be highlighted also creates a file containing a list of objects for omni completion (|compl-omni|) including all objects currently in R's workspace, except the .GlobalEnv objects. These two lists are stored permanently in the ~/.vim/r-plugin directory. The command :RUpdateObjList waits 60 seconds to R finish building the list. If this time is not enough to your system, please, set a different value of |vimrplugin_buildwait|. You should run :RUpdateObjList whenever you upgrade R since some functions are removed and new ones are added at each new R version. If have already run :RUpdateObjList and now want to add the objects of specific libraries to both the list of objects for omnicompletion and the list of functions for syntax highlight you can use the Vim command :RAddLibToList. Example: > :RAddLibToList foreign Matrix < Note: If you have too many loaded packages Vim may be unable to load the list of functions for syntax highlight. If you want to remove the objects of specific libraries, please, delete the corresponding files from ~/.vim/r-plugin/objlist/ directory (the directory may be at a different location if you are using a plugin management system like vim-addons or pathogen). 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 and 'completeopt' to know how to customize the |omni-completion|). 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. 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. Vim uses one for the objects of .GlobalEnv and a list of files for all other objects. The .GlobalEnv list is stored in the /tmp/r-plugin-yourlogin directory and, thus, is deleted after each reboot. 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 ro to either start or updated the Object Browser. The updating is automatic only if the Object Browser is running in a separate Tmux panel. The Object Browser has two views: .GlobalEnv and Libraries. If you either press 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. 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 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 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() When running in a terminal emulator under Tmux, the Object Browser will be updated automatically. One limitation is that objects made available by the command data() may not have their classes recognized in the GlobalEnv view. When running under Tmux, the Normal mode command d deletes the object on the cursor line or the element of a list or data.frame. If the Object Browser is showing the libraries, the library currently under the cursor line is detached. The Object Browser may stop to be updated automatically for a few seconds if you press d many times quickly. Please, use a value greater than 250 to set the time in milliseconds that the Object Browser should wait for R message that the object was already deleted (see |vimrplugin_ob_sleep|). 4.6. Commenting and uncommenting lines~ You can toggle the state of a line as either commented or uncommented by typing xx. You can also add comments to the right of a line with the ; 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 ; over a selection of lines, the comments will be aligned according to the longest line. While typing comments the leader comment string is automatically added to new lines when you reach 'textwidth' but not when you press . 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 : > autocmd FileType r setlocal formatoptions-=t formatoptions+=croql < 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 Vim in a terminal emulator (Linux/Unix only), the Vim-R-plugin will use the screen.vim plugin to restart Vim and start R in a Tmux session. The Tmux configuration file provided by the Vim-R-plugin 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 as the Tmux scape character (the default is ), that is, you have to type before typing a Tmux command. Below are the most useful key bindings to use Tmux with the tmux.conf created by the Vim-R-plugin (see |vimrplugin_notmuxconf| if you prefer to use your own ~/.tmux.conf) arrow keys : Move the cursor to the Tmux panel above, below, at the right or at the left of the current one. : Move the panel division upward one line, that is, resize the panels. Repeat to move more. will move the division downward one line. If you are using the vertical split, you should use and to resize the panels. [ : Enter the copy/scroll back mode. You can use , and vi key bindings to move the cursor around the panel. Press q to quit copy mode. ] : Paste the content of Tmux paste buffer. While in the copy and scroll back mode, the following key bindings are very useful: q : Quit the copy and scroll mode. : Start text selection. v : Start rectangular text selection. : 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: was configured as the Tmux scape character, and it will not be passed to applications running under Tmux. To send to either R or Vim you have to type a. With Tmux, you can the detach the Vim-R session and reattach it latter. This is useful if you plan to begin the use the Vim-R-plugin in a machine and latter move to another computer. However, normally you will get |E325|, caused by the presence of a 'swapfile' (please, read the screen.vim plugin documentation, especially the section |screen-gotchas| for details). This problem will not happen if you start Vim from within a Tmux session, as in the example below. A sample detachable session could be: - 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 < - Start Tmux: tmux - Start Vim: vim theScript.R - Use Vim to start an R session: rf - Send code from Vim to R, and, then, detach Vim and R with d The command will be d if you have not set as the scape character in your ~/.tmux.conf. - Some time latter (even if accessing the machine remotely) reattach the Tmux session: tmux attach See |vimrplugin_only_in_tmux| if you always prefer starting Tmux before starting Vim, but sometimes forget to start Tmux. 4.9. GNU Screen usage~ *r-plugin-screen* When running Vim in a terminal emulator (Linux/Unix only), the Vim-R-plugin will use the screen.vim plugin to restart Vim and start R in a Tmux session. However, the plugin will use GNU Screen if Tmux is not installed or if you have set the value of vimrplugin_tmux = 0 in your |vimrc|. You may want to create your own ~/.screenrc to customize GNU Screen behavior (see |vimrplugin_noscreenrc|). Below are the most useful key bindings to use the Vim-R-plugin with the screenrc that the plugin creates: : Move the cursor to the next panel. a : Decrease the height of the current panel. z : Increase the height of the current panel. [ : Enter the copy/scroll back mode. You can use , and vi key bindings to move the cursor around the panel. Press q to quit copy mode. ] : Paste the content of GNU Screen paste buffer. While in the copy and scroll back mode, the following key bindings are very useful: q : Quit the copy and scroll mode. : Start text selection. : Copy the selection to GNU Screen paste buffer. ============================================================================== *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. The Object Browser segfaults (Linux/Unix only)~ If the Vim instance running the Object Browser crashes you may want to close all Vim instances and kill any Vim wandering around with the command (typed in a terminal emulator): > killall -9 vim < 5.2. R's source() issues~ The R's source() function prints an extra new line between commands if the option echo = TRUE, and error messages and warning are printed only after the entire code is sourced, which makes it more difficult to find errors in the code sent to R. 5.3. 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.4. The buffer name must be in the window title (Windows only)~ On Windows the plugin tries to activate the "R Console" window, paste the command that is being sent to R, and, then, activate the GVim window. To activate the GVim window the plugin requires that the name of the file being edited be in the GVim window title. This is the default if you have not set the option 'titlestring'. 5.5. 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.6. 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. Example: > # 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") < 5.7. Commands are sent twice on Mac OS X~ If you use the screen plugin with GNU Screen, individual lines may be sent duplicated to R on Mac OS X. 5.8. [Errno 98] Address already in use~ When deleting objects using the "d" command in the Object Browser, the message "[Errno 98] Address already in use" may appear. In this case, the Object Browser will not work properly until you stop using it and wait for the time set in 'updatetime' (four seconds, by default). Then, the Object Browser should be normal again. The "d" command is available only when running R on Tmux. 5.9. "VimCom port not found" on OpenBSD~ When the loopback interface has both IPv4 and IPv6 addresses vimcom loads ok but apparently does not listen on the IPv4 address (127.0.0.1), only on the IPv6 one (fe80::1). ============================================================================== *r-plugin-options* 6. Options~ |vimrplugin_term| External terminal to be used |vimrplugin_term_cmd| Complete command to open an external terminal |vimrplugin_underscore| 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_objbr_sleep| Time the Object Browser waits for R after "d" |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_nosingler| A single R process for all Vim instances |vimrplugin_by_vim_instance| Each Vim instance runs its own R |vimrplugin_i386| Use 32 bit version of R |vimrplugin_r_path| Directory where R is |vimrplugin_r_args| Arguments to pass to R |vimrplugin_buildwait| Time to wait for :RUpdateObjList to finish |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_noscreenrc| Do not write custom screenrc |vimrplugin_screenplugin| Use the screen.vim plugin |vimrplugin_screenvsplit| Split the window vertically (screen plugin) |vimrplugin_tmux| Choose between Tmux and GNU Screen |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 args() function |vimrplugin_latexcmd| Command to run on .tex files |vimrplugin_sweaveargs| Arguments do Sweave() |vimrplugin_never_unmake_menu| Do not unmake the menu when switching buffers |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 PDF quietly. |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. 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. 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. Underscore and Rnoweb completion of code block~ *vimrplugin_underscore* *vimrplugin_rnowebchunk* While editing R code, '_' is replaced with ' <- '. To disable this feature, put in your |vimrc|: > let vimrplugin_underscore = 0 < In Rnoweb files, a '<' is replaced with '<<>>=\n@'. To disable this feature, put in your |vimrc|: > let vimrplugin_rnowebchunk = 0 < 6.3. 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 GVim. However, if running Vim in a terminal emulator, the Object Browser will be created in a 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 and the communication with R is being established through Tmux, the Object Browser will be placed besides the R Console in the external terminal emulator. In this case, the command rh will not work on the Object Browser. When deleting an object from the Object Browser (possible if running Vim under Tmux), the following option controls the time in milliseconds that the Object Browser will wait for R to send the message updating the list of objects: > let vimrplugin_ob_sleep = 250m < You should increase this value if the "[Errno 98]" message appears frequently. 6.4. Vim as pager for R help~ *vimrplugin_vimpager* *vimrplugin_editor_w* *vimrplugin_help_w* 6.4.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, put in your .Rprofile: > options(pager = "vim -c 'set ft=rdoc' -") < 6.4.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 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, 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.5. Number of R processes (Linux/Unix only)~ *vimrplugin_nosingler* *vimrplugin_by_vim_instance* 6.5.1 Using (G)Vim without the screen.vim plugin~ By default, all buffers of all (G)Vim instances send code to the same R process. If you prefer that each Vim buffer uses its own R process, put the following option in your |vimrc|: > let vimrplugin_nosingler = 1 < If you prefer that each Vim instance calls its own R process and all the instance's buffers send code to this R process while other Vim instances send code to other R processes then put the following in your |vimrc|: > let vimrplugin_by_vim_instance = 1 > The |vimrplugin_by_vim_instance| option requires that Vim is acting as a command server because the variable |v:servername| is used to make the name of the Tmux session which will run R. By default, GVim runs as server, but Vim does not. Hence, if you are using Vim you have either to start Vim with the argument --servername or use the screen.vim plugin which tries to restart Vim with the --servername argument. If you want to use more than nine GVim instances you will have to use the --servername argument because screen will not differentiate between names like "GVIM1" and "GVIM10". 6.5.2 Using the screen.vim plugin~ Both options are ignored when using Vim in a terminal emulator and using the screen.vim plugin. The plugin behaves as if the |vimrplugin_by_instance| was enabled. 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-2.15.1\\bin\\i386" > On Windows, Vim will try to find the R install path in the Windows Registry. 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. Time necessary to build list of objects for omni completion~ *vimrplugin_buildwait* If your system needs more than 60 seconds to build the list of objects for omni completion after you do the command |:RUpdateObjList|, then you should set the value of |vimrplugin_buildwait| to a higher value. Example: > let vimrplugin_buildwait = 240 > 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 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 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 1 # 1 1 ## 0 0 ### < 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 and Screen configuration (Linux/Unix only)~ *vimrplugin_noscreenrc* *vimrplugin_notmuxconf* GVim (or Vim running R in an external terminal emulator) runs Tmux with a specially built configuration file. It also overwrite the value of |g:ScreenShellTmuxInitArgs|. If you want to use your own ~/.tmux.conf and |g:ScreenShellTmuxInitArgs|, put in your |vimrc|: > let vimrplugin_notmuxconf = 1 < If you want to use your own ~/.screenrc, put in your vimrc: > let vimrplugin_noscreenrc = 1 < 6.15. Integration with screen.vim plugin (Linux/Unix only)~ *vimrplugin_screenplugin* *vimrplugin_screenvsplit* *vimrplugin_tmux* *vimrplugin_only_in_tmux* The screen.vim plugin supports both GNU Screen and Tmux, but only Tmux allows you to split the terminal vertically (that is, to have the panels side by side). Also, the automatic updating of the Object Browser is enabled only when running R in a Tmux session. Please read |screen-intro| and |screen-shell-vertical| for details. By default, the Vim-R-plugin will tell the screen.vim plugin to split the terminal horizontally. If you prefer to split it vertically put in your |vimrc|: > let vimrplugin_screenvsplit = 1 let g:ScreenImpl = 'Tmux' < By default, when running in a terminal emulator, the Vim-R-plugin uses the screen.vim plugin if it is installed and, by default, it will use Tmux instead of GNU Screen. Tmux was chosen as default because it may split the terminal vertically and its regions are easier to resize. If you want that the R Console starts with a specific width, put in your |vimrc| your preferred value: > let g:ScreenShellWidth = 80 < If both GNU Screen and Tmux are installed but you prefer to use the GNU Screen application, put in your |vimrc|: > let vimrplugin_tmux = 0 < If Tmux is not installed, the Vim-R-plugin will use GNU Screen. Start Vim and do the command rf. The screen.vim plugin will split the terminal in two regions and will run R in one of them. Using both plugins at the same time is especially useful for users who may prefer to use Vim and R in a terminal emulator, rather than using the graphical interface provided by GVim. If you prefer to use the plugin in a terminal emulator in a Tmux session, you may prefer to start Tmux before Vim (see |r-plugin-tmux|). In this case, you may want to set the value of |vimrplugin_only_in_tmux| as below: > let vimrplugin_only_in_tmux = 1 < With the above option, the Vim-R-plugin will not start R if not running in a Tmux session, and it will warn you about that. If you have the screen.vim plugin installed but prefer do not integrate it with the Vim-R-plugin you will need to add the following to your |vimrc|: > let vimrplugin_screenplugin = 0 < 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 to run R and Vim in the same terminal emulator split in two regions (Vim and R), put in your |vimrc|: > let vimrplugin_applescript = 0 < If you prefer to have R running in an external terminal emulator, put in your |vimrc|: > let vimrplugin_applescript = 0 let vimrplugin_screenplugin = 0 < 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 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 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 plugin calls tools::texi2pdf() to build the pdf from the generated .tex file. On Linux/Unix, by default, Vim calls pdflatex to produce a pdf document from the .tex file produced by the R Sweave command. 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 and tool bar buttons~ *vimrplugin_never_unmake_menu* Use this option if you want that the menu item R and the R related tool bar buttons are 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 options is enabled all menu items are created regardless of the file type. 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 in the R Console the cursor goes to the beginning of the line and one types 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 may be problematic if using either Tmux or GNU Screen in some systems. The Vim-R-plugin will add to every command if you put in your |vimrc|: > let vimrplugin_ca_ck = 1 < 6.23. Open PDF after processing rnoweb file~ *vimrplugin_openpdf* *vimrplugin_openpdf_quietly* *vimrplugin_openhtml* *vimrplugin_strict_rst* The plugin will try to open automatically the pdf file generated by pdflatex, after either Sweave() or knit(), if you 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|: > ifDISPLAY != "" 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 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 kh. The html file will be automatically opened if you put the following in your |vimrc|: > let vimrplugin_openhtml = 1 < 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 < 6.24. 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 , this can make it very difficult to write R packages or Sweave files. For example, if 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 in your |vimrc|: > let g:vimrplugin_insert_mode_cmds = 0 < The default value is 1, for consistency with earlier versions. 6.25. 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 rm. If you prefer to remove only visible objects, put in your |vimrc|: > let g:vimrplugin_rmhidden = 0 < ============================================================================== *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 RStart imap RStart vmap RStart < The above example shows how to change key binding used to start R from rf to . 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: > RBibTeX RSendChunk RObjectNames RClearAll RDSendChunk RObjectPr RClearConsole RESendChunk RObjectStr RClose REDSendChunk RPlot RCommentLine RSendParagraph RSPlot RCustomStart RDSendParagraph RSaveClose RSendFunction RESendParagraph RSetwd RDSendFunction REDSendParagraph RShowArgs RESendFunction RSendSelection RShowEx REDSendFunction RDSendSelection RShowRout RSendLine RESendSelection RStart RDSendLine REDSendSelection RSummary RSendLAndOpenNewOne RSendFile RSweave RSendMBlock RESendFile RUpdateObjBrowser RDSendMBlock RHelp RVanillaStart RESendMBlock RListSpace RCompleteArgs REDSendMBlock RMakePDF < Note: The prefix RE means "echo"; RD, "cursor down"; RED, both "echo" and "down". 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 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 function, you could write a custom key binding that would allow you to rapidly get the levels of the object under your cursor. Add the following to your |vimrc| to have an easy way to pass R the levels command: > map rk :call RAction("levels") map t :call RAction("tail") map h :call RAction("head") < Then if you type rk R will receive the command > levels(myObject) < You should replace rk with the key binding that you want to use and "levels" with the R function that you want to call. 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 s :call SendCmdToR("search()") < ============================================================================== *r-plugin-files* 8. Files~ The following files are part of the plugin and should be in your ~/.vim directory after the installation: autoload/rcomplete.vim bitmaps/RClearAll.bmp bitmaps/RClearAll.png bitmaps/RClear.bmp bitmaps/RClear.png bitmaps/RClose.bmp bitmaps/RClose.png bitmaps/ricon.png bitmaps/ricon.xbm bitmaps/RListSpace.bmp bitmaps/RListSpace.png bitmaps/RSendBlock.bmp bitmaps/RSendBlock.png bitmaps/RSendFile.bmp bitmaps/RSendFile.png bitmaps/RSendFunction.bmp bitmaps/RSendFunction.png bitmaps/RSendLine.bmp bitmaps/RSendLine.png bitmaps/RSendParagraph.bmp bitmaps/RSendParagraph.png bitmaps/RSendSelection.bmp bitmaps/RSendSelection.png bitmaps/RStart.bmp bitmaps/RStart.png doc/r-plugin.txt ftdetect/r.vim ftplugin/rhelp.vim ftplugin/rnoweb.vim ftplugin/r.vim ftplugin/rbrowser.vim ftplugin/rmd.vim ftplugin/rrst.vim indent/r.vim indent/rhelp.vim indent/rnoweb.vim indent/rmd.vim indent/rrst.vim r-plugin/common_buffer.vim r-plugin/common_global.vim r-plugin/functions.vim r-plugin/objlist/ r-plugin/r.snippets r-plugin/tex_indent.vim r-plugin/vimcom.py r-plugin/vimActivate.js r-plugin/windows.py syntax/rbrowser.vim syntax/rout.vim syntax/r.vim syntax/rmd.vim syntax/rrst.vim ============================================================================== *r-plugin-tips* 9. FAQ and tips~ 9.1. Is it possible to stop R from within Vim?~ Sorry, it is not possible. You have to press ^C into R's terminal emulator. 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 several marks (bookmarks). 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 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 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 This plugin makes it possible to visually manage your marks. 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 in your R script. The plugin may be downloaded from: 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.snippet by concatenating both tex.snippets and r.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 RDSendSelection nmap RDSendLine < You may also want to remap : http://stackoverflow.com/questions/2269005/how-can-i-change-the-keybinding-used-to-autocomplete-in-vim 9.6. Remap the ~ *r-plugin-localleader* People writing Rnoweb documents may find it better to use a comma or other key as the instead of the default backslash (see |maplocalleader|): > 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 function etags2ctags() from the script located at ~/.vim/r-plugin/etags2ctags.R 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.txt| 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 command: > rtags(path = "/path/to/R/source/code", recursive = TRUE, ofile = "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|, 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. 2. Press CTRL-] over "mapply" (Vim should jump to "mapply.R"). 3. Locate the string "do_mapply", which is the name of a C function. 4. Press CTRL-] over "do_mapply" (Vim sould jump to "mapply.c"). 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. 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.11. Automatic line breaks~ By default, Vim breaks lines when you are typing if you reach the column defined by the 'textwidth' option. If you prefer that Vim does not break the R code automatically, breaking only comment lines, put in your |vimrc|: > autocmd FileType r setlocal formatoptions=cq < 9.12. 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: > if [ "x" != "xDISPLAY" ] then if [ "screen" = "$TERM" ] then export TERM=screen-256color else export TERM=xterm-256color fi fi < Finally, put in your |vimrc|: > if &term =~ "xterm" || &term =~ "256" ||$DISPLAY != "" set t_Co=256 endif colorscheme your_prefered_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 all before setting your preference in your |vimrc|. 9.13. 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 sm :update:call SendCmdToR('system("make")') < 9.14. Group windows with compiz~ If you are using Compiz, it may be easier to work with the plugin if the various related windows (editor, terminal, and graphics window) are grouped because they will be raised together when one of them receives the focus. You may need CompizConfig Settings Manager installed to enable this feature (look at the "Window Management" section for "Group and Tab Windows"). 9.15. Why do I have to updated the Object Browser manually?~ It is because Vim and R run as separate processes and, thus, it is not possible to Vim to know whether R is busy or not. If R was running as part of the text editor, as happens with RStudio, JGR, RKward, and others, which are linked to libR.so, it would be possible to wait for R to finish processing a command before sending to it a command to rebuild the list of objects for the Object Browser. This command should be sent after each line sent to R. But if the Vim-R-plugin did this, the use of Vim would be blocked until R finished its processing. 9.16. Edit your ~/.Rprofile~ You may want to edit your ~/.Rprofile. Two common options are the use of GVim as the text editor and the use of Vim as pager. Example for Linux with these two options and some others: > if(interactive()){ library(colorout) library(setwidth) options(vimcom.verbose = 1, vimcom.allnames = TRUE) if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "") library(vimcom) if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != "") setOutputColors256(verbose = FALSE) if(nchar(Sys.getenv("DISPLAY")) > 1){ grDevices::X11.options(width = 4.5, height = 4, ypos = 0, xpos = 1000, pointsize = 10) options(editor = 'gvim -f -c "set ft=r"') options(pager = "gvim -c 'set ft=rdoc' -") } else { options(editor = 'vim -c "set ft=r"') options(pager = "vim -c 'set ft=rdoc' -") } } < The test for the environment variable DISPLAY is useful if you eventually use the plugin over ssh or on the Linux console. 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. An example for Windows: > if (interactive()) { local({ options(editor = '"C:/Program Files (x86)/Vim/vim73/gvim.exe" "-c" "set filetype=r"') options(help_type = "html") }) } < 9.17. 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) < 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 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. There is also the R package "edtdbg" which aims to integrate R debugging facilities with Vim. 9.18. Turn the R-plugin into a global plugin~ *r-plugin-global* The Vim-R-plugin is a file type plugin. If you want its functionality available for all file types, then go to your ~/.vim/plugin directory and create a symbolic link to ~/.vim/r-plugin/global_r_plugin.vim. That is, type the following in a terminal emulator: > cd ~/.vim/plugin/ ln -s ../r-plugin/global_r_plugin.vim < On Windows, you probably will have to make a copy of the file to the ~/vimfiles/plugin directory. 9.19. Disable syntax highlight of R functions~ If you want to disable the syntax highlight of R functions edit the file ~/.vim/r-plugin/functions.vim and delete all lines, but do not delete the file. 9.20. Tips for knitr users~ *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 kr in Normal mode for this, put in your |vimrc|: > nmap kr :call SendCmdToR('rm(list=ls(all.names=TRUE)); unlink("cache/*")') < 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.21. Start Tmux and Vim at once~ If you always prefer to run Tmux before running Vim you may want to put in your ~/.bashrc: > function tvim(){ tmux new-session "vim @" ; } < Then you will be able to start Vim inside a Tmux session by typing: > tvim filename.R < 9.22. Integration with the Conque Shell plugin~ *r-plugin-conque* In addition to being integrated with the screen.vim plugin the Vim-R-plugin can also use the Conque Shell plugin, but the Conque Shell still has some important bugs and Vim has limitations that make the use of Conque Shell not fully satisfying. The most important bug of Conque Shell is that it sometimes do not show the complete output of an R command. This problem happens more frequently when there are non ascii characters in the output. The two most important Vim limitations are: - We cannot scroll the windows of a buffer that is not being edited and, thus, we have to go to the R buffer to scroll it. This is a problem if we are running an R command that slowly generates a lot of output because the shell buffer does not scroll when there is new output but it is not the currently active buffer. - Vim does not have a timer which would make the Conque Shell more efficient. Vim uses the same variable, 'updatetime', to do both save swap files and trigger |CursorHold| events. These limitations will be solved only if someone with good knowledge of C programming writes patches to Vim source code and the patches are accepted by the Vim developer. In addition to these two limitations, the automatic update of the Object Browser only works when running Vim under Tmux. Anyway, if you want to try the Conque Shell, install it from http://www.vim.org/scripts/script.php?script_id=2771 do not load the R package "colorout", and put in your |vimrc|: > let vimrplugin_ca_ck = 0 let vimrplugin_applescript = 0 let vimrplugin_screenplugin = 0 let vimrplugin_conqueplugin = 1 < You may also want to put the following Conque options in your |vimrc| (look at the Conque Shell documentations for details): > let ConqueTerm_CWInsert = 1 let ConqueTerm_Color = 0 let ConqueTerm_ReadUnfocused = 1 < By default, the window will be split horizontally. Put the following in your |vimrc| if you prefer to split the window vertically: > let vimrplugin_conquevsplit = 1 < You may also need to change the time that the Conque Shell waits for R output. After a command is sent to the Conque buffer, the Conque Shell plugin waits 100 milliseconds (on Linux) or 200 milliseconds (on Windows) before reading R's output. Longer values for the waiting time will increase the chances that the output of R commands will be immediately shown in the R Console. To set a different waiting time, change the value of vimrplugin_conquesleep in your |vimrc| as in the example: > let vimrplugin_conquesleep = 300 < To manually scroll the R Console buffer, put the following in your |vimrc| (replace with your preferred key): > nmap :call RScrollTerm() < Then, you will be able to scroll the R Console buffer at any time by pressing the key in Normal mode. Of course, you should replace with your preferred key. With the Conque Shell, the option |vimrplugin_nosingler| is ignored, and, by default, the object browser window will be created at the right of the R Console window. The same highlighting scheme used for .Rout files is applied to the R Console when using the Conque Shell plugin to run R inside a Vim's buffer. For one hand, we do not need to highlight R commands in the Console if they were sent by the plugin from an R script buffer since we have the code highlighted in the script buffer and in the Console we want to pay attention to the output. A too colorful highlighting scheme would be distracting. On the other hand, if we were typing commands directly in the Console it would be beneficial to have the R syntax highlighted. ============================================================================== *r-plugin-news* 10. News~ 0.9.8 (2012-10-04) * 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 command :RAddLibToList to add the objects of specific libraries to omnicompletion. 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 and \r. * 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 . 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 (thanks to Tom Link). * 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. * If ~/.vim/r-plugin/functions.vim is not found, try to copy it from /usr/share/vim/addons/r-plugin/functions.vim. * 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 with in the key bindings. * Added "Send Paragraph" commands. 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. * Added option vimrplugin_term. * 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 script rpager.sh. * 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) * Added documentation. * Added ability to send function to R, revert the automatic conversion of "_" into "<-" and call R's help(). * Added archive with some files to ease desktop integration, if desired. 090507 (2009-05-08) * Initial upload vim:tw=78:ts=8:ft=help:norl