Lech Lorens wrote:

> I have a list of files grouped by file extension. I am trying to create 
> a fold for each of the groups. For this purpose I created the following 
> Vim function:
> function! FoldByExtension()
>     let s:searchSave = @/
>     let s:wrapscanSave = &ws
>     set nowrapscan
>     normal zE
>     1
>     while 1
>         try
>             .,/\v^.*\.(.*)\n(.*\.\1\n)*\zs.+(\1)@<!$/-1fold
>             normal nj
>         catch /E385/
>             break
>         endtry
>     endwhile
>     .,$fold
>     let &ws = s:wrapscanSave
>     let @/ = s:searchSave
> endfunction
> 
> With re=1 Vim correctly processes the following list:
> #v+
> foo.bat
> bar.bat
> baz.bat
> foo.com
> bar.com
> baz.com
> foo.txt
> bar.txt
> baz.txt
> #v-
> creating 3 folds, 3 elements each. With re=2 it creates a single fold 
> containing all the lines.

I can reproduce it by searching for the pattern:

        /\v^.*\.(.*)\n(.*\.\1\n)*\zs.+(\1)@<!$


-- 
GALAHAD: No, please.  Please! I can defeat them!  There's only a hundred.
GIRLS:   He will beat us easily.  We haven't a chance.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" 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 because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui