I'm on Ubuntu 18.04, vim-gtk3 8.0.
I'm trying to get gvim to highlight multiple lines of comment that starts with a particular word. For example, consider the word 'NOTE':
// NOTE(Ryan): This would be highlighted,
// So would this line
// And this line
// This line would not be highlighted
My current attempt looks like this:
syntax region NoteRegion start=#//\s*NOTE#hs=s+2 end=#\n[^/][^/]#he=s-1
highlight NoteRegion guifg=Red
What I intend this to do is start a region with a //
followed by any number of whitespace and then the word NOTE
. The highlighting would start after the //
, hence the hs=s+2
(I know this won't work for consecutive lines). The region would end with a new line followed by any two characters that are not /
. To avoid highlighting these last two characters I have the he=s-1
.
Unfortunately this does not work.
Any suggestions would be greatly appreciated.
EDIT: To avoid my highlights being overwritten, my new attempt is:
augroup CommentMarkers
autocmd!
autocmd Syntax * syntax region NoteRegion start=#//\s*NOTE# end=#\n(\n|.|[^/][^/])#he=s-1
augroup END
highlight NoteRegion guifg=Red