Monday, September 5, 2011

Re: nextgroup across line border

Reply to message «Re: nextgroup across line border»,
sent 22:19:37 05 September 2011, Monday
by Andy Wokula:

> Looks like you have just missed
>
> :h :syn-skipwhite
> :h :syn-skipnl
Yes, I missed this. It is not exactly what I want: this tells vim to ignore \n,
while I know that \n *must* be there, but this is also acceptable, thanks.

I have also a situation where last item may be empty string and it does not work
if one of the rules looks like /.*/. If I was able to match item0onLine1 using
/\nitem0onLine1/ (and add nextgroup=i0l1 to i0l0) it would be better. Or somehow
tell vim that empty string match is acceptable. I can't use `skipnl' for
previous item: it will make /.*/ match on the next line when it is not present.

Original message:
> Am 04.09.2011 19:52, schrieb ZyX:
> > I want to create a syntax for filetype that looks like this:
> > item0onLine0 item1onLine1
> > item0onLine1 item1onLine1
> > separatorLine
> > item0onLine0 item1onLine0
> > item1onLine1 item1onLine1
> > ...
> >
> > In order to do this I try
> >
> > syn match i0l0 /^item0onLine0/ nextgroup=i1l0
> > syn match i1l0 / item1onLine0\n/ contained nextgroup=i0l1
> > syn match i0l1 /item0onLine1/ contained nextgroup=i1l1
> > syn match i1l1 / item1onLIne1\n/ contained
> >
> > , but this works on first line only. How can I have next group located on
> > the next line? `item0onLine1' cannot be matched reliably on its own.
> > `item0onLine0' is always matched reliably.
>
> Looks like you have just missed
>
> :h :syn-skipwhite
> :h :syn-skipnl

No comments:

Post a Comment