On Fri, Nov 1, 2013 at 10:05 AM, Charles Campbell <charles.e.campb...@nasa.gov> wrote: > I note that removing the '#\=\s*\zs' portion from the B match: > > syn clear > > syntax match MyComment '#.*$' contains=A > syntax match A 'a' nextgroup=B skipwhite skipnl > syntax match B 'b' contained nextgroup=B skipwhite skipnl > highlight default link A Type > highlight default link B Error > highlight default link MyComment Comment > > and using it on > > # a b b b > b b > > also shows the "b"s on the second line without highlighting. What I think > is happening is that MyComment matches to only one line which may contain A; > once a newline is encountered, the MyComment match terminates, taking the A > and B matches with it. > I tried using the extend keyword, but that didn't affect the resulting > highlighting.
Yes, I know that, too. But it wasn't what I was asking about. This is: syntax clear syntax match A 'a' nextgroup=B skipwhite skipnl syntax match B '#\=\s*\zsb' contained nextgroup=B skipwhite skipnl hi link A Type hi link B Error There is no comment rule at all. Just an A (which can start anywhere) and a contained B. But in: # a b b b # b b Only the first line is highlighted. If you remove the second #, then both lines are highlighted. I suppose it follows a kind of logic. Normally in: syntax match foo /a/ syntax match bar /aa/ bar takes precedence. However, as you mentioned, if you do: syntax match foo /a/ syntax match bar /a\zsa/ foo takes precedence, even though bar is later, because bar's actual match start doesn't cover the first character. And, a nextgroup is required to match immediately after whatever skip settings are in place. But even though b's pattern matches, the start of the match is not at the first character after skipping, so it is just rejected. I just wouldn't have anticipated that it worked that way. -- Dan -- -- 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.