Skip to main content
added 2 characters in body
Source Link
Cory Klein
  • 333
  • 2
  • 6

Add this line to yourCreate ~/.vimrcvim/ftdetect/SOME_EXTENSION.vim fileand add this line to easily set up your custom filetype detection for a given extensionit:

autocmd BufNewFile,BufRead *.SOME_EXTENSION set syntax=SOME_FILETYPEfiletype=SOME_FILETYPE

So if you wanted vim to use the filetype html for all files with an .Rhtml extension you would doadd this to ~/.vim/ftdetect/rhtml.vim:

autocmd BufNewFile,BufRead *.Rhtml set syntax=htmlfiletype=html

Add this line to your ~/.vimrc file to easily set up your custom filetype detection for a given extension:

autocmd BufNewFile,BufRead *.SOME_EXTENSION set syntax=SOME_FILETYPE

So if you wanted vim to use the filetype html for all files with an .Rhtml extension you would do:

autocmd BufNewFile,BufRead *.Rhtml set syntax=html

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
Source Link
Cory Klein
  • 333
  • 2
  • 6

Add this line to your ~/.vimrc file to easily set up your custom filetype detection for a given extension:

autocmd BufNewFile,BufRead *.SOME_EXTENSION set syntax=SOME_FILETYPE

So if you wanted vim to use the filetype html for all files with an .Rhtml extension you would do:

autocmd BufNewFile,BufRead *.Rhtml set syntax=html