Add a file extension to Vim syntax highlighting

09 Jan 2013

If you use Vim’s syntax highligting you may notice that not all files get correct highlighting, when opened in Vim. To quickly add a file extension to Vim, you can add the extension to your ~/.vimrc file.

syntax on
filetype on
autocmd BufNewFile,BufRead *.pp set filetype=ruby

In the example above, files with a ‘.pp’ extension get ruby syntax highlighting. See ‘:help autocmd’ in Vim for details on autocmd.

blog comments powered by Disqus