vim folding
| 30-Mar-2010 | Posted by Sonia Hamilton under Vim |
A concise article on Linux.com (that I keep referring back to) about vim folding. I’ve been using vi/vim for years and vi keystrokes just “happen”, but it’s always nice to learn a few more tricks, especially when working with larger scripts.
A brief summary of folding:
- highlight some text using v visual mode, zf to fold, zo to unfold (ie open)
- put cursor on an opening curly bracket, and zfa} to fold until closing curly bracket (or zfa) or zfa] for parentheses, square brackets)
- add this to your .vimrc to remember folds:
au BufWinLeave * mkview au BufWinEnter * silent loadview
Lots more commands in the article.
Share This
Thanks! (; Used commands to remember folds (;
Thanks a lot for the remember folds tip.
I have been struggling with this for a while, really annoying, although it only happens for cpp files, not for python or vim scripts.
But yout tip solved the problem.
Thanks!