Using folds in vim
Using folds in Vim is a fantastic way to improve your productivity.
Here’s a screen shot showing Vim open with a Perl module without folds.

And this is a screen shot with folds enabled.

Notice how I’ve folded all the subroutines so I get a nice overview of the code.
By heart these commands:
- zf - Create a fold
- zo - Open a fold
- zc - Close a fold
- zO - Open all folds recursively Yes, folds can be recursive!
- zC - Close all folds recursively
- zR - open all folds
- zM - close all folds
- zi - Toggle between opening/closing all folds
All folding information is lost once you quit Vim. Use mkview to save your folds information and loadview will reload your folds.
This tip from the vim.org website is extremely handy.
Basically you add this to your $HOME/.vimrc file
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent loadview
Happy editing!