[R] R and ViM

Michael Graber grabermi at student.ethz.ch
Mon May 29 23:22:35 CEST 2006


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 funnel.pl, i found out 
that the tasks i wanted to be done by funnel.pl could actually, and 
much more, also be done by

gnuscreen (http://www.gnu.org/software/screen/),

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?

best,
michael





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

>>>>>> "PD" == Peter Dalgaard <p.dalgaard at biostat.ku.dk>
>>>>>>     on 19 Apr 2006 01:06:02 +0200 writes:
>
>     PD> "Jose Quesada" <quesada at gmail.com> 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).
>>>
>>> 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?
>
>     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> https://stat.ethz.ch/pipermail/r-help/2006-April/date.html
>     PD> https://stat.ethz.ch/pipermail/r-help/2006-April/092457.html
>
>     PD> which are easily reachable via
>
>>>> R-help at stat.math.ethz.ch mailing list >
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>
> 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
>



More information about the R-help mailing list