A feature which lets visually hide (and toggle) regions of a text file, by replacing its contents with a single outline line.
It is very useful to expand and collapse sections of a text file using folding, as it makes it easier to navigate around the document and to work on whole regions as they were single lines.
Folding is activated via the foldmethod
(abbreviated to fdm
) option, which is local to each of the vim-windows and determines what kind of folding applies in the current window.
Possible values for foldmethod
are:
manual
– folds must be defined by entering commands (such aszf
)indent
– groups of lines with the same indent form a foldsyntax
– folds are defined by syntax-highlightingexpr
– folds are defined by a user-defined expression
In addition, foldmethod
may have values:
marker
– special characters can be manually or automatically added to your text to flag the start and end of foldsdiff
– used to fold unchanged text when viewing differences (automatically set in vimdiff mode)
For more information: Folding on vim.wikia