Question

I want to highlight all the lines starting with a dot as C code:

syntax include @CSYN syntax/c.vim
syntax region cSnip matchgroup=Snip start=/^\./ end=/$/ contains=@CSYN

It works OK, unless there's an { on the end of the line:

.while(1) {
xxx

In such case the xxx string is highlighted as if it was an C identifier.

How can I switch C syntax highlighting off at the end of the line?

Was it helpful?

Solution

This should be preventable by adding the keepend keyword to the :syntax region definition. Also, since your inclusion only spans a single line, the oneline keyword can be added, too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top