window. Possible values:
|fold-manual| manual Folds are created manually.
|fold-indent| indent Lines with equal indent form a fold.
|fold-expr| expr 'foldexpr' gives the fold level of a line.
|fold-marker| marker Markers are used to specify folds.
|fold-syntax| syntax Syntax highlighting items specify folds.
|fold-diff| diff Fold text that is not changed.
*'foldminlines'* *'fml'*
'foldminlines' 'fml' number (default 1)
local to window
Sets the number of screen lines above which a fold can be displayed
closed. Also for manually closed folds. With the default value of
one a fold can only be closed if it takes up two or more screen lines.
Set to zero to be able to close folds of just one screen line.
Note that this only has an effect on what is displayed. After using
"zc" to close a fold, which is displayed open because it's smaller
than 'foldminlines', a following "zc" may close a containing fold.
*'foldnestmax'* *'fdn'*
'foldnestmax' 'fdn' number (default 20)
local to window
Sets the maximum nesting of folds for the "indent" and "syntax"
methods. This avoids that too many folds will be created. Using more
than 20 doesn't work, because the internal limit is 20.
*'foldopen'* *'fdo'*
'foldopen' 'fdo' string (default "block,hor,mark,percent,quickfix,search,tag,undo")
global
Specifies for which type of commands folds will be opened, if the
command moves the cursor into a closed fold. It is a comma-separated
list of items.
NOTE: When the command is part of a mapping this option is not used.
Add the |zv| command to the mapping to get the same effect.
(rationale: the mapping may want to control opening folds itself)
item commands ~
all any
block (, {, [[, [{, etc.
hor horizontal movements: "l", "w", "fx", etc.
insert any command in Insert mode
jump far jumps: "G", "gg", etc.
mark jumping to a mark: "'m", CTRL-O, etc.
percent "%"
quickfix ":cn", ":crew", ":make", etc.
search search for a pattern: "/", "n", "*", "gd", etc.
(not for a search pattern in a ":" command)
Also for |[s| and |]s|.
tag jumping to a tag: ":ta", CTRL-T, etc.
undo undo or redo: "u" and CTRL-R
When a movement command is used for an operator (e.g., "dl" or "y%")
this option is not used. This means the operator will include the
whole closed fold.
Note that vertical movements are not here, because it would make it
very difficult to move onto a closed fold.
In insert mode the folds containing the cursor will always be open
when text is inserted.
To close folds you can re-apply 'foldlevel' with the |zx| command or
set the 'foldclose' option to "all".
*'foldtext'* *'fdt'*
'foldtext' 'fdt' string (default "foldtext()")
local to window
An expression which is used to specify the text displayed for a closed
fold. The context is set to the script where 'foldexpr' was set,
script-local items can be accessed. See |fold-foldtext| for the
usage.
The expression will be evaluated in the |sandbox| if set from a
modeline, see |sandbox-option|.
This option cannot be set in a modeline when 'modelineexpr' is off.
It is not allowed to change text or jump to another window while
evaluating 'foldtext' |textlock|.
When set to an empty string, foldtext is disabled, and the line
is displayed normally with highlighting and no line wrapping.
*'formatexpr'* *'fex'*
'formatexpr' 'fex' string (default "")
local to buffer
Expression which is evaluated to format a range of lines for the |gq|
operator or automatic formatting (see 'formatoptions'). When this
option is empty 'formatprg' is used.
The |v:lnum| variable holds the first line to be formatted.
The |v:count| variable holds the number of lines to be formatted.
The |v:char| variable holds the character that is going to be
inserted if the expression is being evaluated due to
automatic formatting. This can be empty. Don't insert
it yet!
Example: