Monday, February 27, 2012

Re: Is is vim's bug of syntax and fold?

Thanks.

In my understanding, the larger region will ALWAYS cover small region,
UNLESS you specify transparent to the larger region or you specify the
contains=small to the larger region.

Also, the contained region will eat the end spot so that the parent
region can not end correct if they share the same end point. keepend
can force its childs do keep the end and extend can force to eat the
end spot even its parent has keepend.

Am I right?

On Tue, Feb 28, 2012 at 1:36 AM, Charles Campbell
<Charles.E.Campbell@nasa.gov> wrote:
> Ben Fritz wrote:
>>
>>
>> On Feb 27, 4:45 am, Yichao Zhou<broken.z...@gmail.com>  wrote:
>>
>>>
>>> 3. syn region vimBug1 start="{" end="}"
>>> 4. syn region vimBig2 start="\\begin{homework}" end="\\end{homework}"
>>> transparent fold
>>>
>>>
>>
>> This fails because the end of your vimBug1 group matches the last
>> character of end{homework}, preventing the end of the vimBig2 group
>> from matching at that location. By default, only one pattern can match
>> at a specific spot, which allows nesting.
>>
>> To fix this, you'll need to use the "keepend" keyword. :help :syn-
>> keepend.
>>
>> Note that this will make you unable to nest vimBig2 groups, so you
>> will probably also need to look at :help :syn-extend and make
>> modifications elsewhere in the syntax file.
>>
>>
>
> Well, Ben, you beat me to it!
>
> Yichao Zhou: may I suggest that you try my hilinks.vim plugin
> (http://drchip.0sites.net/astronaut/vim/index.html#HILINKS).   Issue  :HLT!
> with it, and as you move your cursor about, a report on the bottom will
> (succinctly) show you the syntax and highlighting linkages.
>
> In the example you gave:
>
>  \begin{homework}
>  111112222222222
>
> where 1=vimBig2
> and      2=vimBig2->vimBug1
>
> Furthermore, the reason why vimBug1 shows up is due to your use of the
> "transparent" keyword with vimBig2.  Take transparent out, and you get the
> folding you want.
>
> Regards,
> Chip Campbell
>
>
>
> --
> 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

--
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

No comments: