Vim Recall繁體中文

Run command on lines in a closed fold

:folddoclosed

Example

Normal 0 / 2
outer start
  first
  second
  third
outer end
separator
last line
Cursor on line 1, column 1

Run command on lines in a closed fold.

Folds

Line 1 · level 1 Active
closed · lines 1–5
Line 2 · level 2
closed · lines 1–5
Line 3 · level 2
closed · lines 1–5
Line 4 · level 2
closed · lines 1–5
Line 5 · level 1
closed · lines 1–5

Option · foldenable

Local foldenable
1
Global foldenable
1

Option · foldlevel

Local foldlevel
0
Global foldlevel
0
Before & after
Before
outer start
  first
  second
  third
outer end
separator
last line
Cursor on line 1, column 1

Folds

Line 1 · level 1 Active
closed · lines 1–5
Line 2 · level 2
closed · lines 1–5
Line 3 · level 2
closed · lines 1–5
Line 4 · level 2
closed · lines 1–5
Line 5 · level 1
closed · lines 1–5

Option · foldenable

Local foldenable
1
Global foldenable
1

Option · foldlevel

Local foldlevel
0
Global foldlevel
0
After
closed: outer start
closed:   first
closed:   second
closed:   third
closed: outer end
separator
last line
Cursor on line 5, column 1

Folds

Line 1 · level 1
closed · lines 1–5
Line 2 · level 2
closed · lines 1–5
Line 3 · level 2
closed · lines 1–5
Line 4 · level 2
closed · lines 1–5
Line 5 · level 1 Active
closed · lines 1–5

Option · foldenable

Local foldenable
1
Global foldenable
1

Option · foldlevel

Local foldlevel
0
Global foldlevel
0

Start in Normal mode. foldmethod=manual is prepared with lines 2–4 nested inside a fold spanning lines 1–5. The fold panel reports the resulting open and closed state of those ranges.

Details & Vim help

Example replayed in Vim

Run command on lines in a closed fold. This Ex reference uses the full command name; the alphabetical index omits arguments. Supply the ranges, arguments, flags and prerequisite state documented in the linked help. Press Enter to submit a complete command. The index spelling :folddoc[losed] puts the optional abbreviation suffix in square brackets; those brackets are not typed. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative.