I'm experiencing a problem when folding visual blocks - if I
have a section folded directly above another section that I
want to fold, they end up merging once I fold the second
section, sometimes they even add unfolded text to the fold -
am I doing something wrong?
It sounds like your folds are trying to overlap, which Vim
doesn't allow (in fact, every editor with folding that I've used
prohibits folding disjoint-but-overlapping sections).
To see what's already folded, you can use
:set foldcolumn=4
to put some markers in the left-margin (bumping it up from the
default of 0 in case you want/need to reset it). If your new
fold boundaries cross into an existing fold, Vim tries to do the
"sensible" thing and treat the entire folded section as a single
line and extends your fold to take the whole sub-fold into
consideration.
The visual indicator of the fold-column can help you prevent
overlapping sections, which in turn, should help you avoid the
behavior you see.
-tim