Vim Folds

I was originally scared of vim folds. They were confusing and hard to manage. And there were extra shortcuts to learn.

I’ve recently started playing with them and have found that they can be useful, especially with long documents.

The main shortcuts you need to learn are:

za - toggle current fold open/closed
zR - open all folds
zM - close all folds

This would work as an explicit fold:

# My super clever method {{{
def clever_method
  something clever
# }}}

The }}} triple curly braces then let the area fold into something like:

+--  7 lines: My super clever method -----------------

which lets you expand / contract it with za.

It’s probably worth adding za as a shortcut.

There’s loads more you can do with them, but this is a fairly easy way to start to understand them..