vim Folding Configuring the Fold Method


:set foldmethod={method} sets the fold method for the current window. This determines how folds are manipulated within that window. Valid options for "method" are:

  • manual (folds are manually created and destroyed by the user)
  • indent (folds are created for lines of equal indentation)
  • marker (substring markers are used to indicate the beginning and end of a fold)
  • syntax (syntax highlighting items define folds)
  • expr (a Vimscript expression is evaluated per line to define its fold level)
  • diff (text change isn't changed in a diff view is folded)

The default is manual.