[Vim-latex-devel] folding in latex-suite
Brought to you by:
srinathava,
tmaas
From: Srinath A. <sr...@fa...> - 2003-12-04 04:11:34
|
Hello... As you might know, Zhang Linbo has added quite a bit of new functionality to the folding scheme in latex-suite. Now we can customize various things to fold etc. Unfortunately, we also uncovered what seemed to be a few "unfixable" problems. (or at least very hard to fix using the current methods). The problem arises from the fact that we use a simplified syntax folding algorithm implemented in SyntaxFolds.vim to generate the folds. Although the algorithm can handle a fair amount of complexities like folds being nested etc, it fails in some common cases. One problem arises when we try to fold commands. The problem case is to fold something like: \footnote{This is a footnote with \textbf{\texttt{arbitrarily nested}} commands within it} The problem with this set of lines is that there are commands which are arbitrarily nested and the way the inner commands terminate is the same as the way the outer footnote terminates (all commands terminate with a '}'). Other problems arise when we attempt to fold \item's which might have figures in them. In the present scheme we will not be able to fold \begin{figures} environments nested inside \items... (wonder why no one reported this...) In the long term (quite long), we might therefore need to move to using vim's native syntax folding capabilities which are able to handle all these issues. Ofcourse, the present way seems to be more than adequate for most if not all users (no?) I spent some time today learning about vim's syntax scheme... (quite complex too...) Here's a little demo of what can be done without syntaxfolds.vim. Open the attached .tex file and then source the attached .vim file. This should create some of the necessary syntax folds... Its still a /huge/ hack and doesn't fold any sections like latex-suite does, but it does show how relatively simply we can get around the afore-mentioned problems... Ofcourse, even if we do use vim's syntax folding instead of syntaxFolds.vim, folding.vim will not change. (LB, your patches will not be in vain :-)). What will need to change is the interface between folding.vim and syntaxFolds.vim. Basically SyntaxFolds.vim will essentially contain a simple wrapper function which will call vim's :syn command with various parameters. The reason for this e-mail is to hopefully spark some interest in someone to take a further look at things in this direction... Srinath PS: Please reply to the list so everyone is in the loop. |