运行 通过 PuTTy 的 Nvim-R:设置 r_term_cdm

Running Nvim-R via PuTTy: setting up r_term_cdm

我想 运行 Nvim-R on a remote machine via 当我尝试打开 *.R 文件时远程机器 returns 出现错误消息:

Please set the variable g:R_term_cmd in your vimrc. Read the plugin documentation ...

根据 documentation,R_term_cmd 应按以下方式使用:

If |R_in_buffer| = 0 and the X Window System is running and is installed, then R will run in an external terminal emulator. The plugin uses the first terminal emulator that it finds in the following list:

1. gnome-terminal,
2. konsole,
3. xfce4-terminal,
4. Eterm,
5. (u)rxvt,
6. aterm,
7. roxterm,
8. terminator,
9. lxterminal

10. xterm.

If Vim does not select your favorite emulator, you may define it in your vimrc by setting the variable R_term, as shown below:

 let R_term = "xterm" 

If your terminal emulator is not listed above, or if you are not satisfied with the way your terminal emulator is called by the plugin, you may define in your vimrc the variable R_term_cmd, as in the examples below:

let R_term_cmd = "xterm -title R -e"    
let R_term_cmd = "xfce4-terminal --icon=/path/to/icons/R.png --title=R -x"

但是,通过 Vim-R-Tmux: An Integrated Working Environment for R 提供的示例配置文件似乎并未使用此变量。此外,vimrc:

中的设置
" start R with F2 key
map <F2> <Plug>RStart 
imap <F2> <Plug>RStart
vmap <F2> <Plug>RStart
" send selection to R with space bar
vmap <Space> <Plug>RDSendSelection 
" send line to R with space bar
nmap <Space> <Plug>RDSendLine

<LocalLeader> 设置

建议的 <LocalLeader> 设置似乎不起作用,因为按 F2 不会启动连接的 R 会话。

软件版本

tmux 2.3
VIM - Vi IMproved 8.0 

你有两个选择

使用你显然是的 Tmux

这样,Nvim-R 实际上可以使用 tmux 面板来启动 R 控制台。

请参阅文档中的 9.21 Integration with Tmux 部分。

您需要将以下内容放入您的 vimrc:

let R_in_buffer = 0
let R_applescript = 0
let R_tmux_split = 1

或者直接使用 NeoVim

NeoVim 有一个内置终端,它实际上只与 Nvim-R 插件一起工作。