jalvesaq / Nvim-R

Vim plugin to work with R
GNU General Public License v2.0
968 stars 125 forks source link

Support filetype `Rmarkdown` #747

Closed rcst closed 1 year ago

rcst commented 1 year ago

Hi,

I noticed that the (awesome) plugin doesn't recognize files with extension .Rmarkdown. I tried including it into the newly available filetypes list variable

let R_filetypes = ['r', 'rmd', 'rmarkdown', 'rrst', 'rnoweb', 'quarto', 'rhelp']

However, it seems this list can only disable filetypes, not add (as the documentation might imply).

I'd like to have this "filetype" working, because I'm editing both Rmd and Rmarkdown file, which are no different in content, but the blogdown packages sees a difference as to render the former into HTML and the latter always into plain Markdown.

jalvesaq commented 1 year ago

Nvim-R uses Vim's default file type recognition, but .Rmarkdown will be recognized as rmd if you put this in your vimrc:

autocmd BufNewFile,BufRead *.Rmarkdown set ft=rmd

or init.lua:

vim.cmd.autocmd('BufNewFile,BufRead', '*.Rmarkdown', 'set ft=rmd')
rcst commented 1 year ago

Thanks!