On Sat, 14 May 2011 11:09:20 +0200 Andy Wokula <[email protected]> wrote:
> You have a nested match for "parens", but no "keepend" to be
> "extend"-ed.
>
> What works for me is to either remove "extend", or add "keepend" in
> the parens rule:
>
> :sy region parens matchgroup=Operator start=/(/ end=/)/
> contains=TOP " or
> :sy region parens matchgroup=Operator start=/(/ end=/)/
> contains=TOP extend keepend
>
> > <a[a<a>a]a>
> > ^^
>
> The "angles" rule (with pattern "<.\{-}>") matches "<a[a<a>", I don't
> think the contained "[a<a>a]" should make it match "<a[a<a>a]a>".
Notice that the 'a' after the first '>' does get highlighted, and if
you removed 'extend' from these groups, it would nest properly (at
least in a way that it normally does).
>
> > {a<a[a]a>a}
> > ^^
> > What happened?
>
> You use "extend" where it's not needed, apparently Vim doesn't like
> that.
>
> --
> Andy
Apparently. But this means that 'extend' attribute is messing up the
highlighting in situations where it shouldn't change anything. And docs
don't mention it, so I consider this a bug.
The workarounds can seem simple because I have given an example that
contains only what's necessary to show the problem. In real life
situations, the only way to avoid this problem is to ensure that every
extending group that contains other extending groups, also has
'keepend'. It's close to impossible in anything but simplest syntax
files, unless you want to make tens of groups for highlighting the same
syntax element, each for a different keepend/extend scenario. For
example, how would you make a group that extends containing regions,
can nest within itself, and doesn't interrupt contained items?
This sounds simple, and theoretically, the "parens" group from my
example should have these properties, but in practice it doesn't work.
See attached screenshot.
--
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
<<attachment: screenshot2.png>>
