VIM folding commands

Putting in the folds

If you want automated folding, you can use one of these two:
if you are editing program files such as C++, C, etc
set foldmethod=syntax
If you are editing an indented file that Vim does not seem to fold with the above foldmethod, use the option below:
set foldmethod=indent
If you want something more elaborate/different, just do manual folding instead: I have not had to though.. so far!

Fold Commands

Vim folding commands zf#j creates a fold from the cursor down # lines.
zf/string creates a fold from the cursor to string .
zj moves the cursor to the next fold.
zk moves the cursor to the previous fold.
zo opens a fold at the cursor.
zO opens all folds at the cursor.
zm increases the foldlevel by one.
zM closes all open folds.
zr decreases the foldlevel by one.
zR decreases the foldlevel to zero -- all folds will be open.
zd deletes the fold at the cursor.
zE deletes all folds.
[z move to start of open fold.
]z move to end of open fold.

Using the mouse

Folds are a lot easier to use when you have a mouse to expand/contract them while visually looking at them.  If you have already enabled your mouse, use the following command:
set foldcolumn=3
To make the foldcolumn visible.  When you click on a '+' sign in the column, it will expand the fold associated with that '+'.   When you click on other characters in the column, the fold related with that line will get collapsed.  (That is out of my memory: for more detail, simply refer to vim documentation by typing: :help fold)

For using your mouse in vim, check out this page.