Create `~/.vim/ftdetect/SOME_EXTENSION.vim` and add this line to it: autocmd BufNewFile,BufRead *.SOME_EXTENSION set filetype=SOME_FILETYPE So if you wanted vim to use the filetype `html` for all files with an `.Rhtml` extension you would add this to `~/.vim/ftdetect/rhtml.vim`: autocmd BufNewFile,BufRead *.Rhtml set filetype=html