Custumizing Syntax Highlighting in Vim

Posted by sixtyfootersdude on Stack Overflow See other posts from Stack Overflow or by sixtyfootersdude
Published on 2010-03-17T17:53:58Z Indexed on 2010/03/18 21:51 UTC
Read the original article Hit count: 628

Filed under:
|
|

Hey

I have defined a few custom file types for vim. I have done this like this:

In vimrc:

au BufWinEnter,BufRead,BufNewFile *.jak set filetype=jak

And then in jak.vim

syn match arrows /<-/
syn match arrows /->/
syn match arrows /=>/
syn match arrows /<=/
highlight arrows ctermfg=brown
...

This works. (Formatting applies to any file opened with vim with file extension .jak)


My question is how I can keep all the current formatting for a file type but add functionality. For example I would like to add this functionality for .vim files:

syn keyword yellow yellow
highlight yellow ctermfg=yellow
...  

(so that I can see how my terminal interpenetrates different colors before choosing them.)

I have created ~/.vim/syntax/vim.vim (file only contains the above)

and put this into my vimrc:

au BufWinEnter,BufRead,BufNewFile *.vim set filetype=vim

This has no effect. The word yellow is not colored yellow.


I have also tried putting my vim.vim file into ~/.vim/after/syntax/vim.vim

As suggested here

This is the approach that I would like to take. Seems clean and easily maintainable.

© Stack Overflow or respective owner

Related posts about vim

Related posts about customization