gerw / vim-latex-suite

71 stars 16 forks source link

Verbatim not folding #7

Closed riccardosven closed 10 years ago

riccardosven commented 10 years ago

I do not know if this is an issue or a design choice, so bear with me if I am mistaken! The folding command will not fold Verbatim environments (from fancyvrb). I have made this hack, however I feel there must be some better way to do it than manually adding all possible environments we want folded.

Anyone cares to explain the folding mechanism? I really could not follow everything in folding.vim

diff --git a/ftplugin/latex-suite/folding.vim b/ftplugin/latex-suite/folding.vim
index 9057cf4..9bc9d2d 100644
--- a/ftplugin/latex-suite/folding.vim
+++ b/ftplugin/latex-suite/folding.vim
@@ -41,9 +41,9 @@ endfunction " }}}
 "      definitions for them. The first item is supposed to be the "shallowest" field
 "      and the last is the "deepest". See g:Tex_FoldedSections for the default
 "      definition of the lst input argument.
-       "
+"
 "      **works recursively**
-       function! Tex_FoldSections(lst, endpat)
+function! Tex_FoldSections(lst, endpat)
        let i = match(a:lst, ',')
        if i > 0
                let s = strpart(a:lst, 0, i)
@@ -113,8 +113,7 @@ function! MakeTexFolds(force)
        endif

        let s = 'verbatim,comment,eq,gather,align,figure,table,thebibliography,'
-                       \. 'keywords,abstract,titlepage,'
-                       \.'Verbatim'
+                       \. 'keywords,abstract,titlepage'
     if !exists('g:Tex_FoldedEnvironments')
                let g:Tex_FoldedEnvironments = s
        elseif g:Tex_FoldedEnvironments[0] == ','
'''
gerw commented 10 years ago

You can set

let g:Tex_FoldedEnvironments = 'Verbatim'

in your .vim/ftplugin/tex.vim. This will fold Verbatim environments. See also :help latex-folding.

Does this fix your issue?

riccardosven commented 10 years ago

yes, it does! Thanks.