- When I open the file it looks like this: or even this
- When I open all folds, they are closed again when I navigated to another buffer and came back.
- To be able to work with it, I have to apply
zR
each time when opening a buffer.
I have these set up in .vimrc
:
set foldlevelstart=99
set foldlevel=99
Please point me on how to disable the folding, or at least making the navigation to another buffer not to close the opened ones.
Add
set nofoldenable
to your ~/.vimrc to disable folding.Just adding one more to make it complete to the point of discussion.
To enable code folding:
:set foldenable
or in short,:set fen
To disable code folding:
:set nofoldenable
or in short,:set nofen
Once you enable codefolding, you will have all the commands like
zf,zo etc
at your wish according to the setting of:set fdm=xxxx
where typical values areexpr,syntax,manual etc.
Sorry, if I'm answering related question, but I found useful to display two files alongside with folding turned off with something like this:
The easiest way to disable (and enable) folding on the fly is
zi
.zi
is the normal mode command that toggles'foldenable'
, just like:set foldenable!
.Mnemonic: "fold invert". See
:h zi
.Here is an article which briefly and concisely sums up why folding is cool. The one line reason is that folding makes navigating very large files a breeze.
If you want to leave folding enabled, and simply always start with all folds open, the vim wiki tells how. The method of interest to you would probably be the autocommand method.
I would also recommend searching for custom folding methods for the language you use. Simply googling "vim <insert language here> folding" should bring up a number of options. Play around with the different options until you find a folding method you like.
Vim makes it amazingly hard to disable folding, especially when using vimdiff.
None of the above posted solutions worked for me, but this did (add to ~/.vimrc):