Martin Sustrik
Martin Sustrik

Reputation: 813

Vim: region-based highlighting doesn't end at the end of the region

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?

Upvotes: 0

Views: 58

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172768

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.

Upvotes: 1

Related Questions