Vim Syntax-File, Comment after brace not styled -


i have following 3 lines style comments in syntax file. comments start # , allowed inline or on seperate line.

syn keyword     mytodo          contained todo fixme syn match       mycomment       "^#.*" contains=mytodo syn match       mycomment       "\s#.*"ms=s+1 contains=mytodo 

it work long there no character (includes braces, etc) right before #.

i tryed create rule this:

syn match       mycomment       ".*#.*"ms=s+1 contains=mytodo 

but style whole line comment.

what have make style correctly, if there character right before #?

edit

syn match       mycomment       "\s*#.*"ms=s+1 contains=mytodo 

hightlights text after # correctly , text before # not styled comment # isn't styled comment.

if understood well, there no need describe match before sharp sign.

what happens if try this:

syn keyword     mytodo          contained todo fixme syn match       mycomment       "#.*$" contains=mytodo 

it's simple case, doesn't handle case sharp sign included string example (if there strings in syntax). handle additionnally, can add:

syn match       constant      /\v"([^\\]|\\.)*"/ syn match       normal        /^.*$/ contains=constant,mycomment 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -