Note: rewrote the original question to reflect the proper solution given.
vim (ubuntu 12.04 w/ r-plugin) doesn’t recognize .R or .r files as R files with the r-plugin installed with a comment in the file as shown below.
# comment
x <- 2
x
Without the comment, everything works fine.
my ~/.vim/filetype.vim reads:
augroup filetypedetect
au! BufRead,BufNewFile *.r setfiletype r
au! BufRead,BufNewFile *.R setfiletype r
au! BufRead,BufNewFile *.Rnw setf noweb
augroup END
Multiple file types seem to use the
Rextension. I found this in$VIMRUNTIME/filetype.vim:So you need to have comments in the file for Vim to properly detect R.
In case you never use Rexx or Rebol files, you can override the detection: