tags:

views:

114

answers:

1

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.

+3  A: 

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
Al
Thank you so much!
vbd