Very simple vim syntax file
I want to create a very simple vim syntax file that only highlights specific keywords
I saved a file called coffee.vim
in ~/.vim/syntax/
the file has 开发者_如何学Gosyn keyword basicLanguageKeywords if then for in of do
in it
Am I on the right track?
Where do I go from here to actually use that simple vim syntax file?
You're nearly there. You need to specify the colouring of the basicLanguageKeywords type with a line such as:
hi def link basicLanguageKeywords Conditional
(this tells the current colourscheme what to do with the keywords). Then, you can tell Vim to use this syntax by setting the filetype:
setlocal filetype=coffee
That should be all that's needed. If you want all files ending in .coffee to use this syntax file you can add something like
autocmd BufRead,BufNewFile *.coffee setlocal filetype=coffee
to your .vimrc.
Hope this helps.
精彩评论