开发者

Vim: keyword coloring

开发者 https://www.devze.com 2022-12-12 09:18 出处:网络
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.

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
0

精彩评论

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