A code is over 2 000 lines full of folds. I select a certain block in Visual mode to which I would like to start writing. However, things around, such as folds, hinter my writing, and I accidentally tend to modify them. Currently, I avoid such mistakes by writing the block in a separate VIM. It is not a real solution, and it gets awkward with too many VIMs open. How can I hide everything except the block in folds?
You can do zMzv
or zMzO
.
zM
closes all folds, zv
makes current line visible and zO
opens all folds under cursor recursively up to root.
Not exactly what you asked for, but might work...
Map this friend to something:
:vnoremap <Leader>za <Esc>`<kzfgg`>jzfG`<
I have it on leader => z (because it has to do w/ folding) => a (because it stands for "around")
Usage:
Select lines with V, hit leader z a.
Everything above and below will be folded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With