-
Notifications
You must be signed in to change notification settings - Fork 127
Enable Nvim R for any file type
Jakson Alves de Aquino edited this page Sep 11, 2023
·
2 revisions
Nvim-R is a file-type plugin. This means that its functionalities will be
available only when an R file type is being edited (R, Rnoweb, Rhelp, Rmd,
etc). However, if you need to run R with other file types, you can put in your
vimrc
:
command RStart let oldft=&ft | set ft=r | exe 'set ft='.oldft | let b:IsInRCode = function("DefaultIsInRCode") | call StartR("R")
The above Vim line will create the Normal mode command :RStart
which when
run will:
-
Set the file-type of the buffer being edited as "r" and, consequently, enable Nvim-R.
-
Set the file-type back to its original value.
-
Avoid an internal error when you type "_".
-
Start R.