Tuesday, December 29, 2009

Re: very simple braces based folding

On 12/29/09, Christian Brabandt <cblists@256bit.org> wrote:
> Hi Daniel!
>
> On So, 27 Dez 2009, Daniel Fetchinson wrote:
>
>> void x( )
>> -----------------folded--------------
>> void y( )
>> -----------------folded--------------
>>
>> And if the folded regions are unfolded, there are no enclosed folds
>> either (only top level braces are folded).
>>
>> This is all good.
>>
>> Now I have a hard time reproducing all of this with javascript files :(
>
> If I read syntax/javascript.vim correctly you need to enable syntax
> based folding by setting :let javaScript_fold=1 in e.g. your .vimrc.
>
> However there seems to be a bug with syntax based folding, which
> prevents folding. The following patch works for me (I understand syntax
> rules only very basically), therefore cc'ing the maintainer Claudio
> Fleiner.
>
> chrisbra@256bit:~/local/share/vim/vim72/syntax$ diff -Nu
> javascript.vim{.orig,}
> --- javascript.vim.orig 2009-12-29 14:12:39.000000000 +0100
> +++ javascript.vim 2009-12-29 14:12:42.000000000 +0100
> @@ -47,7 +47,7 @@
> syn keyword javaScriptRepeat while for do in
> syn keyword javaScriptBranch break continue
> syn keyword javaScriptOperator new delete instanceof typeof
> -syn keyword javaScriptType Array Boolean Date Function Number
> Object String RegExp
> +syn keyword javaScriptType Array Boolean Date Number Object
> String RegExp
> syn keyword javaScriptStatement return with
> syn keyword javaScriptBoolean true false
> syn keyword javaScriptNull null undefined
>
> The problem seems to be that the syntax keywod javaScriptType
> takes precedence over the defined region javaScriptFunction and
> therefore prevents that the syntax folding applies. Claudio probably
> knows better if this is true and how to fix the problem.
>
> regards,
> Christian

Thanks Christian!

Your patch does indeed fix the problem!

Cheers,
Daniel


--
Psss, psss, put it down! - http://www.cafepress.com/putitdown

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: