specified
with 'foldmarker', at the start and end of the fold. When the text around the
marker matches with 'commentstring', that text is deleted as well.
This does not work properly when:
- A line contains more than one marker and one of them specifies a level.
Only the first one is removed, without checking if this will have the
desired effect of deleting the fold.
- The marker contains a level number and is used to start or end several folds
at the same time.
==============================================================================
2. Fold commands *fold-commands* *E490*
All folding commands start with "z". Hint: the "z" looks like a folded piece
of paper, if you look at it from the side.
CREATING AND DELETING FOLDS ~
*zf* *E350*
zf{motion} or
{Visual}zf Operator to create a fold.
This only works when 'foldmethod' is "manual" or "marker".
The new fold will be closed for the "manual" method.
'foldenable' will be set.
Also see |fold-create-marker|.
*zF*
zF Create a fold for [count] lines. Works like "zf".
:{range}fo[ld] *:fold* *:fo*
Create a fold for the lines in {range}. Works like "zf".
*zd* *E351*
zd Delete one fold at the cursor. When the cursor is on a folded
line, that fold is deleted. Nested folds are moved one level
up. In Visual mode one level of all folds (partially) in the
selected area are deleted.
Careful: This easily deletes more folds than you expect and
there is no undo for manual folding.
This only works when 'foldmethod' is "manual" or "marker".
Also see |fold-delete-marker|.
*zD*
zD Delete folds recursively at the cursor. In Visual mode all
folds (partially) in the selected area and all nested folds in
them are deleted.
This only works when 'foldmethod' is "manual" or "marker".
Also see |fold-delete-marker|.
*zE* *E352*
zE Eliminate all folds in the window.
This only works when 'foldmethod' is "manual" or "marker".
Also see |fold-delete-marker|.
OPENING AND CLOSING FOLDS ~
A fold smaller than 'foldminlines' will always be displayed like it was open.
Therefore the commands below may work differently on small folds.
*zo*
zo Open one fold under the cursor. When a count is given, that
many folds deep will be opened. In Visual mode one level of
folds is opened for all lines in the selected area.
*zO*
zO Open all folds under the cursor recursively. Folds that don't
contain the cursor line are unchanged.
In Visual mode it opens all folds that are in the selected
area, also those that are only partly selected.
*zc*
zc Close one fold under the cursor. When a count is given, that
many folds deep are closed. In Visual mode one level of folds
is closed for all lines in the selected area.
'foldenable' will be set.
*zC*
zC Close all folds under the cursor recursively. Folds that
don't contain the cursor line are unchanged.
In Visual mode it closes all folds that are in the selected
area, also those that are only partly selected.
'foldenable' will be set.
*za*
za Summary: Toggle the fold under the cursor.
When on a closed fold: open it. When folds are nested, you
may have to use "za" several times. When a count is given,
that many closed folds are opened.
When on an open fold: close it and set 'foldenable'. This
will only close one level, since using "za" again will open
the fold. When a count is given that many folds will be
closed (that's not the same as repeating "za" that many
times).
*zA*
zA When on a closed fold: open it recursively.
When on an open fold: close it recursively and set
'foldenable'.
*zv*
zv View cursor line: Open just enough folds to make the line in
which the cursor is located not folded.
*zx*
zx Update folds: Undo manually opened and closed folds: re-apply
'foldlevel', then do "zv": View cursor line.
Also forces recomputing folds. This is useful when using