开发者

Very simple vim syntax file

开发者 https://www.devze.com 2023-02-10 01:06 出处:网络
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/

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号