How to do syntax highlighting for a keyword containing a period (.)?

370 Views Asked by At

I tried the below to no avail.

syn keyword myConstant foo.bar "foo.bar" foo\.bar

What can I do to make this work?

1

There are 1 best solutions below

1
Daniel On

There is a string what identifies what are valid characters in a keyword. The string is called iskeyword (which sounds like a bool).

The default string as of this writing is @,48-57,192-255,$,_

The solution was to modify the iskeyword string to include the period which I appended at the end. The final result is: syntax iskeyword @,48-57,192-255,$,_,.