Vim Tips Wiki
Advertisement

Use this page to discuss script 2628 2628

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

Bugs

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)

Fixed in version 100803.


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: > source('/var/lib/vim/addons/r-plugin/vimhelp.R') ; .vim.help('by', L) Error in tools::Rd2txt_options(width = w) : object 'L' not found

In the vim window: Error detected while processing function RAction..ShowRDoc..SetRTextWidth: line 45: E767: Too many arguments to printf()

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?


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

Comments

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.

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

Vim-R-Plugin and LaTeX-suite

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?

  1. Have both LaTeX code and R code highlighted
  2. latex-suite mappings working (inserting environments etc)
  3. 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....

Advertisement