[Vim-latex-cvs] vimfiles/ftplugin/latex-suite folding.vim,1.22,1.23
Brought to you by:
srinathava,
tmaas
From: <sri...@us...> - 2003-12-02 11:16:08
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1:/tmp/cvs-serv23729 Modified Files: folding.vim Log Message: Change: By default do not fold any commands at all. This is because the start pattern for a command requires a regexp which will match unbalanced parentheses of arbitrary depth. Apparently it can be proved that this cannot be done with regexps. Just to be on the safe side, change the start pattern for a command to '^\s*\\'.name.'{[^{}]*$'. This will at least ensure that no illegal folds are created. The limitation is that some legal folds might also not be created. Index: folding.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/folding.vim,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** folding.vim 2 Dec 2003 10:56:20 -0000 1.22 --- folding.vim 2 Dec 2003 11:16:04 -0000 1.23 *************** *** 93,97 **** endif ! let s = 'footnote,intertext' if !exists('g:Tex_FoldedCommands') let g:Tex_FoldedCommands = s --- 93,104 ---- endif ! " By default do not fold any commands. It looks like trying to fold ! " commands is a difficult problem since commands can be arbitrarily nested ! " and the end patterns are not unique unlike the case of environments. ! " For this to work well, we need a regexp which will match a line only if ! " a command begins on that line but does not end on that line. This ! " requires a regexp which will match unbalanced curly braces and that is ! " apparently not doable with regexps. ! let s = '' if !exists('g:Tex_FoldedCommands') let g:Tex_FoldedCommands = s *************** *** 269,273 **** if s != '' if pass == 0 ! call AddSyntaxFoldItem('^\s*\\'.s.'{','^\s*}',0,0) else call AddSyntaxFoldItem('^\s*\\begin{'.s,'^\s*\\end{'.s,0,0) --- 276,287 ---- if s != '' if pass == 0 ! " NOTE: This pattern ensures that a command which is ! " terminated on the same line will not start a fold. ! " However, it will also refuse to fold certain commands ! " which have not terminated. eg: ! " \commandname{something \bf{text} and ! " will _not_ start a fold. ! " In other words, the pattern is safe, but not exact. ! call AddSyntaxFoldItem('^\s*\\'.s.'{[^{}]*$','^\s*}',0,0) else call AddSyntaxFoldItem('^\s*\\begin{'.s,'^\s*\\end{'.s,0,0) |