I have a long code file with syntax folding in Vim.
I know how to open all folds (zR) or close all folds (zM), and I know how to increase or decrease the foldlevel (zm,
Yes, you can type
:%foldc
Which closes one level of folds (outside in).
I think you want to add set foldnestmax=1
to your $MYVIMRC
.
As Karl says, the foldnestmax
setting is probably what you want.
zO
(i.e., capital-letter-o) opens all nested folds.
I also find zx
and zv
very helpful.
When I use foldmethod=expr
with a custom fold expression, I'll often modify the expression so that it only folds what I want it to fold.