Vim: keyword coloring
Lately I came up here with a similar question. I want to color special words in all files independet from the active syntax-file. It works with words like开发者_运维技巧 DONE and ADD. I tried to achieve the same with [+] or [x] and [-] but it doesn't work. [+] and so on them not to be interpreted as keyword. Fooling around with iskeyword+=[+] and escaping the bracktes [+] didn't help. The following line is in the .vimrc:
syn keyword tododone DONE ADD \[+\] containedin=ALL
As mentioned DONE and ADD work but not [+]. Any help appreciated.
The keyword would have to be made up only of keyword characters (see :help 'iskeyword'
), so [+] won't work: you'll have to use a match:
syn match tododone /\[+\]/ containedin=ALL
syn keyword tododone DONE ADD containedin=ALL
See:
:help syn-match
:help syn-keyword
精彩评论