Maxim Kim wrote:
> On 19 фев, 00:28, Brett Stahlman <[email protected]> wrote:
>>> Unfortunatly It doesn't work:
>> How about something like this?
>> :syntax region level1 start=/^![^!]\+.*/ end=/^![^!]\+.*/me=s-1 fold
>> contains=level2
>> :syntax region level2 start=/^!![^!]\+.*/ end=/^!!\?[^!]\+.*/me=s-1
>> fold contained
>>
>> It works for me, but doesn't exclude the newlines leading up to the
>> next level. I don't have time right now to determine why the original
>> version with the \n\+\ze doesn't work properly. Perhaps I'll be able
>> to look at it tonight if no one else has answered...
>
> Thanks a lot -- it works like a charm!
> Could you point me where I can read about "me=s-1"? Is it kind of
> "offset" in :h search-offset?
:help syn-pattern-offset
Without the 'contained' attribute, level2 will be allowed to occur at
the top level. I was assuming, perhaps incorrectly, that you didn't want
this. Without the 'contains=' in level1 (or a 'containedin=' in level2),
level2 would not *normally* be recognized inside level1. It seems to be
recognized in this case because of the 'transparent' attribute. You can
verify this by removing 'transparent' and highlighting the regions like
so...
:hi level1 guifg=red
:hi level2 guifg=blue
...in which case, you should find that level2 goes away. I suspect that
the 'transparent' attribute implies 'contained', though I did not see
this stated explicitly in the help...
Incidentally, you may have noticed that the sentence beginning with "It
works for me..." in my previous post made no sense. I see now that you
weren't trying to exclude newlines from the region that contained them.
Brett Stahlman
>
> PS:
> By the way, if I remove contains and contained -- it still works.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---