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

Patrice Kiener p@tr|ce@k|ener @end|ng |rom |nmode||@@com
Fri Dec 17 18:48:29 CET 2021


With Debian and macOS, the default editor (getenv("EDITOR") or 
getOption("editor")) is "vi" which opens vi/vim. The following instruction:

   fileREP <- file.path(R.home("etc"), "repositories")
   system2(getOption("editor"), fileREP, wait = FALSE)

works fine with Windows but is inappropriate in the Debian/RStudio/RCode 
console as it launchs vi/vim, warns about input and outputs and prints 
the text file WITHIN the R console and then does nothing. Closing vi/vim 
requires a manual action. In several tests, I even had to force R to 
recover. Hence My question is:

What is the system(), sytem2(), eventually file.edit() instruction that 
opens the text file with vi/vim in a NEW Unix terminal and allows to 
keep working in the R console?

Thank you for your advices.

-- 
Patrice Kiener



More information about the R-SIG-Debian mailing list