Ⅰ. 插件描述
Evaluate R (www.r-project.org) code via rcom, rserve, screen, or tmuxⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/rcom'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/rcom'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/rcom'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/rcom
Ⅳ. 文档说明
The rcom ftplugin uses one of the following methods to evaluate R code:
screen ... default method; works under Linux & Windows (with cygwin/mintty & Windows Rterm)
screen or tmux ... via the screen vim plugin; works under Linux & Windows
RServe ... requires +ruby and the rserve-client rubygem; works under Linux & (less reliably) under Windows
RCom interface ... requires http://rcom.univie.ac.at; works under Windows
With the exception of RCOM, most methods should work also under Mac OS
but that was not tested.
After installation, interaction with R is enabled for all
buffers with filetype r. For other filetypes, you can use the
functions |rcom#EvaluateInBuffer()|.
Features:
- Evaluate R code
- Operator map
- Maps for normal, visual, and insert mode
- Keyword map (|K|)
- Inspect & edit/fix object (<LocalLeader>K)
- Debug functions
The following features are supported only with some methods:
- Omnicompletion for R
- Get return values from R
Maps~
The ftplugin provides several maps (see also |g:rcom_map|,
|g:rcom_mapp|) to evaluate R code and optionally print the result in
normal, insert, and visual mode. There is also an operator (see
|g:rcom_mapop|).
Default Maps:
<c-cr> ... Evaluate the current line
<c-s-cr> ... Evaluate the current line & print result
+. ... Evaluate the current line (normal mode)
+{motion} ... Operator
[visual]+ ... Evaluate the visual area
+p ... Toggle printing for the above maps
+d ... Toggle a function's debug status
+l ... Open the log window
++ ... Evaluate the |maparg| previously mapped to +
K ... Info on the word under cursor
<LocalLeader>K ... Inspect/edit/fix the object under cursor
Normal usage~
0. Optional steps:
a. Prepare a running instance of RGui if using the RCOM
method.
b. RCOM and screen methods: The results get printed in the R
window. You might want to arrange the windows in a way,
so that you can see VIM, R console and R graphic device
at the same time.
1. Open an R source file in VIM.
2a. Type <c-cr> to evaluate the current line/visual area in R.
2b. Type [count]+ or +{motion} to evaluate some text in R. (You can
type ++ to invoke |+|.)