Re: [R] R and ViM

From: Michael Graber <>
Date: Tue 30 May 2006 - 07:22:35 EST

dear all,

to close the open question i asked more than a month ago, i would like to tell you my conclusions:

exchanging emails with larry clapp who wrote, i found out that the tasks i wanted to be done by could actually, and much more, also be done by

gnuscreen (,

which is a 'a full-screen window manager that multiplexes a physical terminal between several processes'. quite interesting thing.

anyway. what i'm doing now to use vim with r is, to open a screen session with r and vim running within it:

%screen R

starts screen with R in it. then i open another window with 'ctrl-a c'. 'ctrl-a' start screen internal commands. in this new shell i can start vim normally to edit my .r-file. to change windows i use 'ctrl-a space'.

now i can split the window with 'ctrl-a S'. to jump between the splitted halfs you can use 'ctrl-a tab'. i normally resize the r window with 'ctrl-a :resize 8', to make 8 lines high.

to send text from one window to another i put into my .screenrc - file:

bind y at R# paste .

this makes it possible to use 'ctrl-a y' to send your buffer to the R window.
to get something into your buffer you make use of the screen copy mode

'ctrl-a [' starts the copy mode. now you can start copying by pressing 'space', move the cursor and then pressing 'space' again. if you want to cut off the line numbers you can press 'v' before pressing 'space' the second time.
now you can send the buffer as i told above.

this works pretty well so far!

what i would like to improve further is, to be able to copy whole lines and blocks with simple commands, maybe with sending it to r directly. any ideas?


On Apr 19, 2006, at 8:42 AM, Martin Maechler wrote:

>>>>>> "PD" == Peter Dalgaard <>
>>>>>> on 19 Apr 2006 01:06:02 +0200 writes:
> PD> "Jose Quesada" <> writes:
>>> 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).
>>> 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?
> PD> I saw it the first time... Could it be that your mail
> PD> reader is set up to ignore mail from yourself?
> PD> Rather than resending stuff, it is preferable to check
> PD> the archives
> PD>
> PD>
> PD> which are easily reachable via
>>>> mailing list >
> Indeed. Please do check the archives.
> 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.
> Martin
> mailing list PLEASE do read the posting guide! Received on Tue May 30 07:39:18 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 30 May 2006 - 10:10:29 EST.

Mailing list information is available at Please read the posting guide before posting to the list.