A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Code folding in vi

All you ever wanted to know about code folding in vim, including keys: http://www.linux.com/archive/articles/114138

Config settings for code folding: http://smartic.us/2009/04/06/code-folding-in-vim/

Vim documentation for folding: http://www.vim.org/htmldoc/fold.html
There are six methods to select folds:

manual manually define folds
indent more indent means a higher fold level
expr specify an expression to define folds
syntax folds defined by syntax highlighting
diff folds for unchanged text
marker folds defined by markers in the text

Key concepts:
  • To use the indent method you need to set the :tabstop correctly
  • Syntax method requires the correct syntax files to be present
Commands:
  • zc -> close fold
  • zo -> open fold