vim code folding

set foldmethod=marker

  • At the beginning of a function fragment, you can type ‘zfap’ to create a fold; this should add some {{{ }}} tags around your code in the comment of choice for the language you’re coding in.
  • You can type ‘zo’ to open a fold, or I can just hit the right arrow key on the folded code marker.
  • You can type ‘zc’ to close a fold.
  • You can type ‘zr’ to open all folds.
  • You can type ‘zm’ to close all folds.