Skip to content
Advertisement

Running Nvim-R via PuTTy: setting up r_term_cdm

I would like to run Nvim-R on a remote machine via when I try to open a *.R file the remote machine returns an error message:

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

According to the documentation, the R_term_cmd should be used in the following manner:

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"

However, this variable does not appear to be utilised by the sample configuration files available through the Vim-R-Tmux: An Integrated Working Environment for R. Furthermore, the settings in 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> settings

The suggested <LocalLeader> settings not appear to work as pressing F2 does not launch connected R session.

Software versions

tmux 2.3
VIM - Vi IMproved 8.0 

Advertisement

Answer

You have two options

Use Tmux, which you apparently are

This way, Nvim-R can actually use a tmux pane to start an R console.

Please refer to section 9.21 Integration with Tmux in the documentation.

You need to put the following in your vimrc:

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

Or just use NeoVim

NeoVim has a builtin terminal, which actually just works with the Nvim-R plugin.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement