Dan Doel wrote:
On Sunday, October 27, 2013 4:56:18 PM UTC-4, Christian Brabandt wrote:
A workaround is something like this (which looks cleaner for me)

syntax match MyComment '#.*$' contains=A,B

syntax match A 'a' nextgroup=B skipwhite skipnl
syntax match B 'b' contained nextgroup=B skipwhite skipnl
This does something different, though. For instance, the original should not 
highlight the bs in the second row of:

     # a b b
     # c b b

while the replacement will.

I don't think the original should actually work as specified, since it would 
make sense to me for the nextgroups to be contained in the comment region, 
which is one line. But, even without the comment match, it doesn't work 
correctly; the \zs stops the pattern from matching for some reason, as noted, 
which doesn't seem right.

(to make sense of my examples, please used a fixed width font) (am avoiding html to do this myself as that prompts screams and bewailings from some of the group)


Now, including the OP's syntax highlighting:

M: syntax match MyComment '#.*$' contains=A
A: syntax match A 'a' nextgroup=B skipwhite skipnl
B: syntax match B '#\=\s*\zsb' contained nextgroup=B skipwhite skipnl

MMAMBMB
# a b b
# b b
MMMMM

At the time the syntax hilighter sees the "#" in "# b b", note that '#\=\s*\zsb' DOES NOT MATCH.
However, the "M" syntax DOES MATCH, and so its highlighted as MyComment.

Syntax highlighting is tricky.

Regards,
Charles Campbell


--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui