Reputation: 325
How can I write literal Exclamation Mark either as Keyword or Match in my own Vim syntax highlighting definition file(.vim)?
syn keyword aaaPos aaa
syn keyword aaaNeg !aaa
I want to define separately "!aaa" and "aaa". When I write definition !aaa, it is overwritten by aaa.
I tried \!aaa, tried match [!]aaa, [\!]aaa still doesn't work.
I read this file but cannot find example for exclamation mark. Thank you. http://vimdoc.sourceforge.net/htmldoc/pattern.html#pattern
Upvotes: 1
Views: 311
Reputation: 7627
From Vim's reference manual:
- Syntax patterns
In the syntax commands, a pattern must be surrounded by two identical characters. This is like it works for the ":s" command. The most common to use is the double quote.
Most likely, you need to enclose the searching patterns in double quotes like:
syn keyword aaaPos "aaa" syn keyword aaaNeg "!aaa"
Upvotes: 1