Monday, November 29, 2010

Vim syntax higlight

To enable vim highlight user file type two things should be done:
  1. Write a ~/.vim/syntax/mytype.vim file with the description of the syntax highlighting rules.
  2. New file type ('mytype') is detected by adding its description into: ~/.vim/filetype.vim:
Example of description added to filetype.vim:
" VHDL
au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst setf vhdl
au BufNewFile,BufRead *.vhdl_[0-9]* call s:StarSetf('vhdl')

If syntax highlighting is not enabled by default, it can be enabled with: :set syntax=mytype

No comments: