I have the following three lines to style comments in my syntax file. Comments start with # and are allowed to be inline or on a seperate line.
syn keyword myTodo contained TODO FIXME
syn match myComment "^#.*" contains=myTodo
syn match myComment "\s#.*"ms=s+1 contains=myTodo
It does work as long as there is no character (includes braces, etc) right before the #.
I tryed to create a rule like this:
syn match myComment ".*#.*"ms=s+1 contains=myTodo
but this would style the whole line as comment.
What do I have to do to make it style correctly, even if there is a character right before the #?
EDIT
syn match myComment "\s*#.*"ms=s+1 contains=myTodo
Hightlights the text after # correctly and the text before # is not styled as a comment but the # isn't styled as comment.