Friday, July 1, 2011

Vim file type detection: only R for .r and .R

copied from 
http://biostat.mc.vanderbilt.edu/wiki/Main/RVim

Filetype detection

Vim includes syntax highlighting for two other languages that use the .r and .R file extensions. Vim searches up to the first 50 lines of a file and checks the comment syntax to determine whether it is R or Rexx. If no comments are found, it defaults to Rexx. This can be annoying for starting a new script. If you want .r and .R to ALWAYS be associated with R syntax, put au BufNewFile,BufRead .r,.R  setf r in your ~/.vim/filetype.vim (alternatively, you can use the same line in~/.vim/ftdetect/r.vim).

=====

Under ubuntu maverick, I would just change file /usr/share/vim/vim72/filetype.vim 


No comments: