Home Explore Blog CI



neovim

8th chunk of `runtime/doc/fold.txt`
1363b037ccdbce675d9ba7314bd243aa2347837a1dcc05290000000100000944
 current window is set to
the window that displays the line.

Errors are ignored.  For debugging set the 'debug' option to "throw".

The default value is |foldtext()|.  This returns a reasonable text for most
types of folding.  If you don't like it, you can specify your own 'foldtext'
expression.  It can use these special Vim variables:
	v:foldstart	line number of first line in the fold
	v:foldend	line number of last line in the fold
	v:folddashes	a string that contains dashes to represent the
			foldlevel.
	v:foldlevel	the foldlevel of the fold

If the result is a |List|, it is parsed and drawn like "overlay" virtual text
(see |nvim_buf_set_extmark()|), otherwise the result is converted to a string
where a TAB is replaced with a space and unprintable characters are made into
printable characters.

The resulting line is truncated to fit in the window, it never wraps.
When there is room after the text, it is filled with the character specified
by 'fillchars'.

If the 'foldtext' expression starts with s: or |<SID>|, then it is replaced
with the script ID (|local-function|).  Examples: >
		set foldtext=s:MyFoldText()
		set foldtext=<SID>SomeFoldText()
<
Note that backslashes need to be used for characters that the ":set" command
handles differently: Space, backslash and double-quote. |option-backslash|


FOLDCOLUMN						*fold-foldcolumn*

'foldcolumn' is a number, which sets the width for a column on the side of the
window to indicate folds.  When it is zero, there is no foldcolumn.  A normal
value is auto:9. The maximum is 9.

An open fold is indicated with a column that has a '-' at the top and '|'
characters below it.  This column stops where the open fold stops.  When folds
nest, the nested fold is one character right of the fold it's contained in.

A closed fold is indicated with a '+'.

These characters can be changed with the 'fillchars' option.

Where the fold column is too narrow to display all nested folds, digits are
shown to indicate the nesting level.

The mouse can also be used to open and close folds by clicking in the
fold column:
- Click on a '+' to open the closed fold at this row.
- Click on any other non-blank character to close the open fold at this row.


OTHER OPTIONS

'foldenable'  'fen':	Open all folds while not set.
'foldexpr'    'fde':	Expression used for "expr" folding.
'foldignore'  'fdi':	Characters used

Title: Fold Text Details, Fold Column, and Other Fold-Related Options
Summary
This section elaborates on the 'foldtext' option, explaining its default behavior, how it uses special Vim variables (v:foldstart, v:foldend, v:folddashes, v:foldlevel), and how to handle errors and script-local functions. It then describes the 'foldcolumn' option, which controls the width and display of the fold indicator column, and how to interact with it using the mouse. Finally, it briefly mentions other fold-related options like 'foldenable', 'foldexpr', and 'foldignore'.