fladson/vim-kitty

Improve regex for keywords that can also be values

fladson opened this issue · 2 comments

For some keywords (background, foreground, etc.) that can also be values, we need to check if the string is at the beginning of the line or not to treat it accordingly.

We can remove the repetition in declaring those with a better regex expression.

Hi, I started writing a kitty syntax file this weekend before coming across this one. Maybe we could merge our versions?

I solved this issue by introducing an extra layer of matching around keywords:

syn match kittyKW '^\S*' contains=kittyOptions
syn match kittyMapKW '^\(mouse_\)\?map' contains=kittyMap
			\ nextgroup=kittyKeybind

kittyOptions is equivalent to your kittyKeyword, but without removing options, that may also be values. Using the contained parameter, they then are all only matched if at the beginning of the line.
If you'd like, I can create a PR.

Hey @crater2150, sure, a PR would be great!