Dear all, I'm starting to learn R, but I'm already programing for a while, using ViM as editor. Therefore I'd like to be able to use R together with ViM. My question now is, whether there are already people out there knowing how to do this in a similar easy way as with Emacs, and if those would be willing to share this knowledge. I did already research on the web on this topic, but i couldn't find satisfying answers, except one good looking approach on the ViM-website with a perl-script called funnel.pl, which I couldn't make running on my mac OSX 10.3.9 so far. I'd be grateful for help. Thanks, Michael Graber
Michael Graber wrote:> Dear all, > > I'm starting to learn R, but I'm already programing for a while, using > ViM as editor. Therefore I'd like to be able to use R together with > ViM. > > My question now is, whether there are already people out there knowing > how to do this in a similar easy way as with Emacs, and if those would > be willing to share this knowledge. > I did already research on the web on this topic, but i couldn't find > satisfying answers, except one good looking approach on the ViM-website > with a perl-script called funnel.pl, which I couldn't make running on > my mac OSX 10.3.9 so far. > > I'd be grateful for help. > > Thanks, > Michael Graber > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlTry RSiteSearch('vim editor') at the R prompt. I got 28 hits. HTH, --sundar
This was just posted this week: https://www.stat.math.ethz.ch/pipermail/r-help/2006-April/092457.html and I think there are some relevant macros on the vim web page I use vim but do not use anything special with it. It gives syntax highlighting out of the box. On 4/18/06, Michael Graber <grabermi at student.ethz.ch> wrote:> Dear all, > > I'm starting to learn R, but I'm already programing for a while, using > ViM as editor. Therefore I'd like to be able to use R together with > ViM. > > My question now is, whether there are already people out there knowing > how to do this in a similar easy way as with Emacs, and if those would > be willing to share this knowledge. > I did already research on the web on this topic, but i couldn't find > satisfying answers, except one good looking approach on the ViM-website > with a perl-script called funnel.pl, which I couldn't make running on > my mac OSX 10.3.9 so far. > > I'd be grateful for help. > > Thanks, > Michael Graber > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
Hmm, how timely. I posted yesterday my solution to integrate R and vim. The message is in my sent box but I don't think it showed up in the list... Here it is again: Hi All, If you use vim to edit R code, you may be interested in this. I have put together a personalized syntax file, some code templates, and a way to send code from Vim to R using autoHotKeys (windows). http://www.andrew.cmu.edu/user/jquesada/RvimSuite/instructions.html Actually, the little autoHotKeys can be useful even if you don't use vim just to send the example R code from the help pages to the console. Best wishes, -Jose PS: @list moderators Any idea why my message (from a @gmail account) appeared in the sent box but never on the list? On 4/18/06, Michael Graber <grabermi at student.ethz.ch> wrote:> Dear all, > > I'm starting to learn R, but I'm already programing for a while, using > ViM as editor. Therefore I'd like to be able to use R together with > ViM. > > My question now is, whether there are already people out there knowing > how to do this in a similar easy way as with Emacs, and if those would > be willing to share this knowledge. > I did already research on the web on this topic, but i couldn't find > satisfying answers, except one good looking approach on the ViM-website > with a perl-script called funnel.pl, which I couldn't make running on > my mac OSX 10.3.9 so far. > > I'd be grateful for help. > > Thanks, > Michael Graber > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >-- Cheers, -Jose -- Jose Quesada, PhD. j.quesada at sussex.ac.uk Dept. of Psychology http://www.andrew.cmu.edu/~jquesada Sussex University Brighton, UK
[Michael Graber]>[...] I'd like to be able to use R together with ViM. [...] My >question now is, whether there are already people out there knowing how >to do this in a similar easy way as with Emacs [...]I've been an Emacs user for a very long time, and then, switched to Vim. See http://pinard.progiciels-bpi.ca/opinions/editors.html, if you feel curious, for a few personal thoughts on Emacs. For R, I tried sticking to a mere interactive shell, taking advantage of the "GNU readline" interface built into R, with Vim as an external editor. For sending R code from Vim to R, one merely selects the code to send within Vim using the mouse, and paste it directly with the mouse in the interactive shell window running R. Simple and comfortable! :-) Emacs offers ESS, which has many interesting features. However, despite quite attractive, it did not fully seduce me: a bit because I try to avoid returning to Emacs keystroke habits, a bit because ESS is heavy weighted compared to Vim + R-in-a-shell solution, a bit because ESS adds distracting idiosyncrasies, like scrolling differently or opening extra windows at times. R already offers enough options I could customize if I want to read help in a browser or a pager, and at good speed. (Of course, if you use an heavy browser, you feel it; but "links -g" is OK!) An ESS nicety that my current setup does not really replace is the automatic highlighting or R output. One of the advantages of this output highlighting is visually spotting R requests and replies. As a compromise, I'm using this bit of a kludge in my Rprofile file: if (interactive()) { local({ options(editor='vim -c "set ft=r"') if (Sys.getenv('TERM') %in% c('rxvt', 'xterm')) { onglet = 2 options(prompt=paste(sep='', formatC('', width=80-onglet), '\033[;30;45m', formatC('', width=onglet), '\033[0m\n', options('prompt'))) } }) } The "set ft=r" bit ensures proper highlighting and coloration within Vim, whenever edit() or fix() are used. Here "vim" could be replaced by "gvim" or "gvim -f", say. (In my Vim configuration, "vim" uses the GUI automatically if started within X; or uses the console mode otherwise.) Then, the R prompt is modified to visually mark each request-reply interaction with a white separating line holding a small violet marker at the right. It works nicely for me in almost all circumstances (there are a few, uncommon exceptions). Usual scrolling of the shell window allows me to quickly find R commands and replies, even if much less colourful than with ESS. I'm ready to pay that price for simplicity. A last trick which is convenient in my case. My X window manager allows customization of keystrokes. (I'm using Openbox, but surely many other window manages offer that possibility too.) For all 26 of Ctrl-Alt-Letter, the same small "openbox-helper" (Python) script of mine is called with the Letter given as an option, which may launch applications in turn. This is how Ctrl-Alt-R opens a shell window running R, and Ctrl-Alt-M opens a shell window running Maxima. In both these shells, Ctrl-D closes the application and the window. This is convenient for quick mathematical jobs, and quite in the spirit of Vim (fast and easy start/exit, instead of long running like Emacs). -- Fran?ois Pinard http://pinard.progiciels-bpi.ca
Michael Graber wrote:> My question now is, whether there are already people out there knowing > how to do this in a similar easy way as with Emacs, and if those would > be willing to share this knowledge.I prefer Vim myself, but because of the great features in ESS, I now use Emacs+ESS in Vi mode. Just type 'M-x viper-mode', and you'll have access to almost all your favourite Vim commands and keybindings. It works very well. -- Karl Ove Hufthammer E-mail and Jabber: karl at huftis.org
To: Martin Maechler <maechler at stat.math.ethz.ch>> Indeed. Please do check the archives.Yep. Post is there.> Now back to the subject: Jose, I think your main contribution > is based on "autoHotKeys" and that only works on Windoze, right? > Michael explicitly mentioned he's working in Mac OS X. > > MartinThat's correct, autoHotKeys is a win-only solution. Bill West's solution uses use Win32::OLE, so I guess that means it's win-only solution. I think Fran?ois Pinard's is the easiest since it uses vim and R only (no 3rd application/language requireed), and that would probably work in all platforms (not sure if the "GNU readline" inferface is implemented in all builds of R, though). I find autoHotKey very useful (e.g., it fires vim to fill textboxes like this one -gmail editing window-, offering syntax highlighting etc) so I use it all the time and don't mind. I can understand those who don't want to install it just to communicate R and an editor. In that case, the other two solutions are better. I'll refer to them in my Rvim page (archives). However, the new R.vim syntax file has 3-level coloring, and I'm working to get improved indentation, TODO, DEBUG, etc highlighting, and other improvements. The code templates using tSkeleton (not ready yet) may be an added advantage. Those two things you can use even if you don't use autohotkeys of course. -- Cheers, -Jose PS: it seems that google mail (as an email reader) doesn't let you see your own messages when posting to a list you are subscribed to. -- Jose Quesada, PhD. j.quesada at sussex.ac.uk Dept. of Psychology http://www.andrew.cmu.edu/~jquesada Sussex University Brighton, UK -- Cheers, -Jose -- Jose Quesada, PhD. j.quesada at sussex.ac.uk Dept. of Psychology http://www.andrew.cmu.edu/~jquesada Sussex University Brighton, UK