[R-sig-Debian] Open a text file with vi/vim in another Terminal

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Fri Dec 17 19:46:59 CET 2021

On Fri, 17 Dec 2021 18:48:29 +0100
Patrice Kiener <patrice.kiener using inmodelia.com> wrote:

>    system2(getOption("editor"), fileREP, wait = FALSE)

Starting a new terminal is somewhat hard, but the shortest path to
getting this particular command working would be options(editor =
'gvim'). It's almost like Vim in a terminal, plus a few features useful
in a windowed interface.

Note that gvim backgrounds itself by default, so this would break
edit() and file.edit(): since the GVim process started by R terminates
almost immediately after spawning a child to do the rest of the work, R
decides that the editing session is done. Unfortunately, it's hard to
make R's edit() pass the -f flag to gvim to prevent it from doing that,
but a trivial shell script wrapper could be used for that purpose:

exec gvim -f "$@"

Best regards,

More information about the R-SIG-Debian mailing list