Put the following into ~/.vim/after/ftplugin/tex.vim
:
setlocal foldlevel=999
This way, folding is kept intact, and all folds are only opened for Latex files. You can close all folds with zM
.
(This requires that you have :filetype plugin on
; use of the after directory allows you to override any default filetype settings done by $VIMRUNTIME/ftplugin/<filetype>.vim
.) Alternatively, you could define an :autocmd FileType <filetype> setlocal
directly in your ~/.vimrc
, but this tends to become unwieldy once you have many customizations.