30 Mar 2010
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.comments powered by Disqus