Search code examples
vimvim-syntax-highlighting

error when defining a new vim syntax


Why can't this line correctly highlight all things between (* and *) as comments in vim?

syn region   datsComment start="(\*" end="\*)" contains=datsComment,datsTodo
hi def link datsComment Comment

Solution

  • It does for me (in a fresh buffer without other syntax definitions). You probably have other syntax elements there that prevent a match.

    You need to find out which syntax group causes that. :syn list shows all active groups, but it's easier when you install the SyntaxAttr.vim - Show syntax highlighting attributes of character under cursor plugin. If you find other syntax groups obscuring the match, you probably should include them in the contains=datsComment,datsTodo,... part.