Contents

Great plugin!
I use it on Sweave files, along with the latex-suite. I have a problem though : I cannot run the Sweave and Pdf command (from the menu or the \sp mapping) since vim complains and returns me a "Too many arguments for function: RMakePDF".

Any help appreciated, thanks!

Could you please tell me what happens if you change line 105 of ftplugin/r.vim from:

If your Vim session's working directory is not the directory containing the R-file you are working with, the commands to send lines that require writing a temp file will fail because a '/' will be inserted into the temp file's name. (reported on Mac OS X) --16:48, August 3, 2010

Everything is working for me except for the help and object browser features. These would be really helpful. I'm using R 2.12.0 on debian, with vim 7.1.314 and the "screen" program. I would like the help to appear in the vim window so that I can send examples to the R window. I've tried it both with the tools package loaded and unloaded, which seemed relevant. When I do \rh I get these error messages.
In the R window:

The g:rplugin_htw does not seem to be sent to the vim.help function. If I change the R command to something random like .vim.help('by', 80L) then I get other errors. Am I missing something obvious or some aspect of the installation? --Preceding unsigned comment added by Loren9 21:01, November 21, 2010

I use Gvim 7.3 under Windows XP 64bit Server 2003 (Service Pack 2) with Python 2.7.1. The R-Plugin seems to work but when I open a .R file I get an error message from the Microsoft Visual C++ Runtime Library:

Runtime Error!
Program: C:\Program Files (x86)\Vim\vim73\gvim.exe
R6034
An application has made an attempt to load the C runtime library incorrectly.
Please contact the application's support team for more information.

If I click "Ok" it works properly as far as I can see, however getting the error message every time is a bit annoying. --Preceding unsigned comment added by Peinzinger 15:56, April 21, 2011

When I launch R from within Vim using R-Plugin, I expect that the working directory in R should automatically be set to the path of the current Vim buffer, according to the code in $HOME/.vim/r-plugin/common_global.vim. However, it is not. Instead, it is set to my home directory.

I suspect it may have something to do with the R.app "Initial Working Directory" preference, which is set to my home directory. R.app may somehow be overriding the working directory command that R-Plugin is attempting to set. Any ideas?

It appears that the problem is not specific to the R.app GUI. I edited common_global.vim, telling it to use a non-gui R, and this R version exhibits the same problem described above. Also, I tried the current developmental version of R-Plugin, and the same problem occurs with it as well. --20:21, January 27, 2012

In taking a closer look at the relevant code in $HOME/.vim/r-plugin/common_global.vim, it occurs to me that I may be misunderstanding how R-Plugin is supposed to work, when it comes to setting the path of the current Vim buffer. It appears that this isn't even supposed to happen automatically when a Vim instance is launched, but only after the command '\rd' is passed to R from a Vim buffer.

If this is right, I'd like to change this bug report to a feature request. Namely, I think it makes a lot of sense to 1.) automatically change the current working directory in R to the directory containing the current Vim buffer when R is launched from within Vim using R-Plugin ('\rf') and 2.) to automatically load .RData and and .Rhistory (or .Rapp.history, for Mac users using R.app), if the directory contains these files.

If I can figure out Vim scripting within the next week or so, I may submit a patch against common_global.vim to add these features. --08:46, January 28, 2012

For me it seems, that sending a visual block with \ss to R is not working as expected. For example, if I have a commented block and want to send to it to R for evaluation, the whole lines are sent. Leading to not being evaluated, caused by the comment --Feb, 2012

Sorry but I don't know how to get only the block. I'm using getline("'<", "'>") to get the selected lines (Jakson, February 12, 2012).

The \rn command was resulting in an error that the "vim.names" function wasn't found in R. I changed lines 2432 and 2457 of the .vim/r-plugin/common_global.vim file to remove "vim." and just have the statement read ':call RAction("names")'. Seems to work fine now, but this is my first time using this plugin, so maybe I misunderstood something. (Echo, 21 Jan, 2013)

This script is a huge help; I use it every day. One feature I would love to see would be an option to connect to an R session within an already-running screen session. I occasionally program on remote machines via ssh, so I can't launch a new terminal but I can start a screen-R session separately and connect to it later. I have tinkered with this myself but my programming skills leave much to be desired. --19:26, October 5, 2010

Please, read the section Integration with screen.vim (:h vimrplugin_screenplugin). There is an explanation on how to detach a screen session. You can also use the Conque Shell plugin. Then you would simply start Vim with the command "screen vim". --Preceding unsigned comment added by Jalvesaq 10:13, November 14, 2010

Thanks for this script! It's a life changer for me (on Ubuntu). One question though: My Sweave files usually have more text than R code. There is more LaTeX code than R code. Consequently there is more latex coding than R coding for me. In that context latex-suite plugin is indispensable. Is there a way to take advantage of both plugins (vim-r and latex-suite) simultaneously?

Have both LaTeX code and R code highlighted

latex-suite mappings working (inserting environments etc)

vim-r-plugin mappings working as well to be able to execute some R code etc.

Now that I think of it perhaps it would have been beneficial to split the vim-r-plugin in the usual way, i.e. separate scripts for syntax highlighting, key mappings etc. so that they can be used separately as well. --16:17, December 2, 2010

Some of the syntax and indent scripts are now on the official Vim runtime and they may be dropped from the .zip distribution of the Vim-R-plugin about one year after a new version of Vim is officially released. They will be kept on the github repository, though.

Support for the R-package inlinedocs, to document code inline; nice would be also folding on comment sections like in the vim-pandoc plugin -- Febuary 10, 2012

I don't use inlinedocs. So, please explain what specifically you want. You could send an email to me with an R script with the code indented as you want and explain where it should be folded. If it's an easy thing to do, I'll write the code into indent/r.vim and syntax/r.vim. However, if it requires to much time, I'm sorry, but I would wait for a patch (Jakson, February 12, 2012).

Turn vim-r-plugin into a more general plugin, supporting other Read-Eval-Print-Loop languages, like haskell (ghci), ruby (irb) or lisp (clisp) -- Febuary 10, 2012

Please get the last github version. I have just made it easier to use the plugin as a general one. There is basic support for a few specific languages (python, ruby, haskell and lisp) in the file r-plugin/global_r_plugin.vim which should be copied to ~/.vim/plugin and edited as needed by the user (Jakson, February 14, 2012).