[R] R and ViM
wjwest at CLEMSON.EDU
Wed Apr 19 21:20:04 CEST 2006
Here is my solution for integrating R and Vim. It uses the rcom library and
Vim's perl functionality. Improvements or suggestions are appreciated!
The following is my r.vim file. This requires the rcom library in R.
perl << EOF
my @pos = $curwin->Cursor();
my $coms = $curbuf->Get($pos);
my @coms = split /\n/ , $coms;
my $R = Win32::OLE->GetActiveObject('RCOMServerLib.StatConnector')
$R->EvaluateNoReturn( "cat('> " . $coms . "\n')");
unless ( $coms =~ /<-/ || $coms =~ /print/ )
$coms = "print(" . $coms . ")";
my $temp = $R->Evaluate( $coms );
map <F11> <Esc>:call Rcom()<cr>j
map <F12> <Esc>:call Rinit()<cr>
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Martin Maechler
Sent: Wednesday, April 19, 2006 2:42 AM
To: Jose Quesada
Cc: r-help at stat.math.ethz.ch; Michael Graber
Subject: Re: [R] R and ViM
>>>>> "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).
>> 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
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> which are easily reachable via
>> > R-help at stat.math.ethz.ch 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.
R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide!
More information about the R-help