Hi Ben!

On Do, 14 Jul 2011, Ben Fritz wrote:

> On Jul 14, 1:38 am, "Christian Brabandt" <[email protected]> wrote:
> > On Wed, July 13, 2011 7:13 pm, Ben Fritz wrote:
> > > On Jul 13, 1:11 am, "Christian Brabandt" <[email protected]> wrote:
> > >> I tried once using several
> > >> :syn match Evenl /.*/ nextgroup=Oddl
> > >> :syn match Oddl /.*/ nextgroup=Evenl
> > >> :hi Evenl ctermbg=Red ctermfg=Black
> > >> :hi Oddl ctermbg=Yellow ctermfg=Black
> >
> > >> Unfortunately, this did not work. I am not sure why. My understanding
> > >> of the syntax highlighting was, that the nextgroup parameter should
> > >> force matching the next group. But somehow it ends always matching the
> > >> same group. Not sure if this is a bug or my understanding is wrong.
> >
> > > I think it is because you aren't including the newline in the match.
> > > So, Oddl matches first, tries matching Evenl on the line ending (which
> > > fails because line endings aren't matched with '.'), and therefore
> > > Oddl matches again on the next line. Possibly just using ^.*\n as the
> > > pattern would fix it, but this will probably not work well together
> > > with existing syntax highlights. That's why I suggested matchadd()
> >
> > Yes, this works. Thanks for pointing me to the obvious ;)
> >
> 
> But, how well does it work with existing syntax? Is it easy to apply
> to C highlighting, for example? I imagine it would be very easy to get
> into a tangled mess of contains and containedin tweaks, so that it
> would be difficult to apply generically to all syntaxes. But I haven't
> ever tried, so maybe I'm just being paranoid.

It works, but overrides your existing syntax rules (I guess because of 
:h syn-priority). And it get's empty lines wrong.

Mit freundlichen Grüßen
Christian

-- 
You received this message from the "vim_use" 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

Reply via email to