views:

140

answers:

3

I have tried the usual approaches, and have read :help tex.vim (see : http://vimdoc.sourceforge.net/htmldoc/syntax.html )

I've taken a brief look at syntax/tex.vim, but can't see how to disable it without rebuilding vim without folding. I'm sick of hitting 'zE'.

Lines I've tried in my .vimrc:

set foldlevel=manual
set foldlevelstart=99
let g:tex_fold_enabled=0
+1  A: 

The folding functionality all seems to located in folding.vim file of latex-suite distribution. This file is referenced in line 825 of my main.vim file in the latex-suite folder of the ftplugin folder. That line reads:

exe 'source '.fnameescape(s:path.'/folding.vim')

Comment out that line and, as far as I can tell, it strips out all the folding in latex-suite plugin. I don't think it affects anything else, but I haven't checked.

Herbert Sitz
Hmm - modifying files installed by my package manager, or rebuilding vim. Neither are great options tbh (I'm running Gentoo, so re-building isn't a problem; there just doesn't seem to be a folding USE flag!). If no one comes up with a better solution, I'll file a bug with vim-latex.
James Broadhead
It's not really a bug, since it's by design, just an option that is not yet included. It would be relatively trivial for them to add such an option to the plugin. There are probably other simple ways of disabling folding, like adding something like this command to your vimrc: au BufRead *.tex exe "zi"
Herbert Sitz
Well, usually "options not yet included" go in a bug tracker - that's what I meant. That au BufRead command doesn't work for me.
James Broadhead
+1  A: 

Just noticed that there are variables to control folding in vim-latex-suite, at least as of v1.6 of the plugin. The functionality is documented here: http://vim-latex.sourceforge.net/documentation/latex-suite.html#latex-folding

In short you should be able to change three global variables to get rid of all folding:

 :let Tex_FoldedSections=""
 :let Tex_FoldedEnvironments=""
 :let Tex_FoldedMisc=""

That should get rid of all folding. If you want to disable some folding but not all then you can control things by setting the appropriate values for each variable, as described in the documentation link above. Hope that helps.

Herbert Sitz
Yes, this works just fine - thanks for the link to the docs. I'll have to try to get the version in my distro's package manager updated now ;)
James Broadhead
+2  A: 

What about

autocmd Filetype tex setlocal nofoldenable
Peter
That works very well, but I'm going to go with Herbert's second answer, for the extra detail and links to documentation. Thank you.
James Broadhead
I haven't tried, but that sounds like good idea. Merely entering the commands in .vimrc (as OP did) executes them once when Vim is opened. Having the filetype autocmd will execute whenever a buffer is opened. I don't know whether the autocmd will execute before or after vim-latex already sets up folding. If after, then executing 'remove all folds' (zE) may also be helpful.
Herbert Sitz
Regardless of order-of-execution, this works for me.
James Broadhead