neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

fold.txt (25711B)


      1 *fold.txt*      Nvim
      2 
      3 
      4 	  VIM REFERENCE MANUAL	  by Bram Moolenaar
      5 
      6 
      7 Folding						*Folding* *folding* *folds*
      8 
      9 You can find an introduction on folding in chapter 28 of the user manual.
     10 |usr_28.txt|
     11 
     12                                      Type |gO| to see the table of contents.
     13 
     14 ==============================================================================
     15 1. Fold methods					*fold-methods*
     16 
     17 The folding method can be set with the 'foldmethod' option.
     18 
     19 When setting 'foldmethod' to a value other than "manual", all folds are
     20 deleted and new ones created.  Switching to the "manual" method doesn't remove
     21 the existing folds.  This can be used to first define the folds automatically
     22 and then change them manually.
     23 
     24 There are six methods to select folds:
     25 manual		manually define folds
     26 indent		more indent means a higher fold level
     27 expr		specify an expression to define folds
     28 syntax		folds defined by syntax highlighting
     29 diff		folds for unchanged text
     30 marker		folds defined by markers in the text
     31 
     32 
     33 MANUAL						*fold-manual*
     34 
     35 Use commands to manually define the fold regions.  This can also be used by a
     36 script that parses text to find folds.
     37 
     38 The level of a fold is only defined by its nesting.  To increase the fold
     39 level of a fold for a range of lines, define a fold inside it that has the
     40 same lines.
     41 
     42 The manual folds are lost when you abandon the file.  To save the folds use
     43 the |:mkview| command.  The view can be restored later with |:loadview|.
     44 
     45 
     46 INDENT						*fold-indent*
     47 
     48 The folds are automatically defined by the indent of the lines.
     49 
     50 The foldlevel is computed from the indent of the line, divided by the
     51 'shiftwidth' (rounded down).  A sequence of lines with the same or higher fold
     52 level form a fold, with the lines with a higher level forming a nested fold.
     53 
     54 The nesting of folds is limited with 'foldnestmax'.
     55 
     56 Some lines are ignored and get the fold level of the line above or below it,
     57 whichever is lower.  These are empty or white lines and lines starting
     58 with a character in 'foldignore'.  White space is skipped before checking for
     59 characters in 'foldignore'.  For C use "#" to ignore preprocessor lines.
     60 
     61 When you want to ignore lines in another way, use the "expr" method.  The
     62 |indent()| function can be used in 'foldexpr' to get the indent of a line.
     63 
     64 
     65 EXPR						*fold-expr*
     66 
     67 The folds are automatically defined by their foldlevel, like with the "indent"
     68 method.  The value of the 'foldexpr' option is evaluated to get the foldlevel
     69 of a line.  Examples:
     70 This will create a fold for all consecutive lines that start with a tab: >
     71 :set foldexpr=getline(v:lnum)[0]==\"\\t\"
     72 This will make a fold out of paragraphs separated by blank lines: >
     73 :set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1
     74 This does the same: >
     75 :set foldexpr=getline(v:lnum-1)=~'^\\s*$'&&getline(v:lnum)=~'\\S'?'>1':1
     76 
     77 Note that backslashes must be used to escape characters that ":set" handles
     78 differently (space, backslash, double quote, etc., see |option-backslash|).
     79 
     80 The most efficient is to call a function without arguments: >
     81 :set foldexpr=MyFoldLevel()
     82 The function must use v:lnum.  See |expr-option-function|.
     83 
     84 These are the conditions with which the expression is evaluated:
     85 
     86 - The current buffer and window are set for the line.
     87 - The variable "v:lnum" is set to the line number.
     88 
     89 The result of foldexpr then determines the fold level as follows:
     90  value			meaning ~
     91  0			the line is not in a fold
     92  1, 2, ..		the line is in a fold with this level
     93  -1			the fold level is undefined, use the fold level of a
     94 		line before or after this line, whichever is the
     95 		lowest.
     96  "="			use fold level from the previous line
     97  "a1", "a2", ..	add one, two, .. to the fold level of the previous
     98 		line, use the result for the current line
     99  "s1", "s2", ..	subtract one, two, .. from the fold level of the
    100 		previous line, use the result for the next line
    101  "<1", "<2", ..	a fold with this level ends at this line
    102  ">1", ">2", ..	a fold with this level starts at this line
    103 
    104 The result values "=", "s" and "a" are more expensive, please see
    105 |fold-expr-slow|.
    106 
    107 It is not required to mark the start (end) of a fold with ">1" ("<1"), a fold
    108 will also start (end) when the fold level is higher (lower) than the fold
    109 level of the previous line.
    110 
    111 There must be no side effects from the expression.  The text in the buffer,
    112 cursor position, the search patterns, options etc. must not be changed.
    113 You can change and restore them if you are careful.
    114 
    115 If there is some error in the expression, or the resulting value isn't
    116 recognized, there is no error message and the fold level will be zero.
    117 For debugging the 'debug' option can be set to "msg", the error messages will
    118 be visible then.
    119 
    120 If the 'foldexpr' expression starts with s: or |<SID>|, then it is replaced
    121 with the script ID (|local-function|).  Examples: >
    122 	set foldexpr=s:MyFoldExpr()
    123 	set foldexpr=<SID>SomeFoldExpr()
    124 <
    125 An example of using "a1" and "s1": For a multi-line C comment, a line
    126 containing "/*" would return "a1" to start a fold, and a line containing "*/"
    127 would return "s1" to end the fold after that line: >
    128  if match(thisline, '/\*') >= 0
    129    return 'a1'
    130  elseif match(thisline, '\*/') >= 0
    131    return 's1'
    132  else
    133    return '='
    134  endif
    135 However, this won't work for single line comments, strings, etc.
    136 
    137 |foldlevel()| can be useful to compute a fold level relative to a previous
    138 fold level.  But note that foldlevel() may return -1 if the level is not known
    139 yet.  And it returns the level at the start of the line, while a fold might
    140 end in that line.
    141 
    142 It may happen that folds are not updated properly.  You can use |zx| or |zX|
    143 to force updating folds.
    144 
    145 MINIMIZING COMPUTATIONAL COST				*fold-expr-slow*
    146 
    147 Due to its computational cost, this fold method can make Vim unresponsive,
    148 especially when the fold level of all lines have to be initially computed.
    149 Afterwards, after each change, Vim restricts the computation of foldlevels
    150 to those lines whose fold level was affected by it (and reuses the known
    151 foldlevels of all the others).
    152 
    153 The fold expression should therefore strive to minimize the number of
    154 dependent lines needed for the computation of a given line: For example, try
    155 to avoid the "=", "a" and "s" return values, because these will require the
    156 evaluation of the fold levels on previous lines until an independent fold
    157 level is found.
    158 
    159 If this proves difficult, the next best thing could be to cache all fold
    160 levels in a buffer-local variable (b:foldlevels) that is only updated on
    161 |b:changedtick|:
    162 >vim
    163  func MyFoldFunc()
    164    if b:lasttick == b:changedtick
    165      return b:foldlevels[v:lnum - 1]
    166    endif
    167    let b:lasttick = b:changedtick
    168    let b:foldlevels = []
    169    " compute foldlevels ...
    170    return b:foldlevels[v:lnum - 1]
    171  enddef
    172  set foldexpr=s:MyFoldFunc()
    173 <
    174 In above example further speedup was gained by using a function without
    175 arguments (that must still use v:lnum). See |expr-option-function|.
    176 
    177 SYNTAX						*fold-syntax*
    178 
    179 A fold is defined by syntax items that have the "fold" argument. |:syn-fold|
    180 
    181 The fold level is defined by nesting folds.  The nesting of folds is limited
    182 with 'foldnestmax'.
    183 
    184 Be careful to specify proper syntax syncing.  If this is not done right, folds
    185 may differ from the displayed highlighting.  This is especially relevant when
    186 using patterns that match more than one line.  In case of doubt, try using
    187 brute-force syncing: >
    188 :syn sync fromstart
    189 
    190 
    191 DIFF						*fold-diff*
    192 
    193 The folds are automatically defined for text that is not part of a change or
    194 close to a change.
    195 
    196 This method only works properly when the 'diff' option is set for the current
    197 window and changes are being displayed.  Otherwise the whole buffer will be
    198 one big fold.
    199 
    200 The 'diffopt' option can be used to specify the context.  That is, the number
    201 of lines between the fold and a change that are not included in the fold.  For
    202 example, to use a context of 8 lines: >
    203 :set diffopt=filler,context:8
    204 The default context is six lines.
    205 
    206 When 'scrollbind' is also set, Vim will attempt to keep the same folds open in
    207 other diff windows, so that the same text is visible.
    208 
    209 
    210 MARKER						*fold-marker*
    211 
    212 Markers in the text tell where folds start and end.  This allows you to
    213 precisely specify the folds.  This will allow deleting and putting a fold,
    214 without the risk of including the wrong lines.  The 'foldtext' option is
    215 normally set such that the text before the marker shows up in the folded line.
    216 This makes it possible to give a name to the fold.
    217 
    218 Markers can have a level included, or can use matching pairs.  Including a
    219 level is easier, you don't have to add end markers and avoid problems with
    220 non-matching marker pairs.  Example: >
    221 /* global variables {{{1 */
    222 int varA, varB;
    223 
    224 /* functions {{{1 */
    225 /* funcA() {{{2 */
    226 void funcA() {}
    227 
    228 /* funcB() {{{2 */
    229 void funcB() {}
    230 <							*{{{* *}}}*
    231 A fold starts at a "{{{" marker.  The following number specifies the fold
    232 level.  What happens depends on the difference between the current fold level
    233 and the level given by the marker:
    234 1. If a marker with the same fold level is encountered, the previous fold
    235   ends and another fold with the same level starts.
    236 2. If a marker with a higher fold level is found, a nested fold is started.
    237 3. If a marker with a lower fold level is found, all folds up to and including
    238   this level end and a fold with the specified level starts.
    239 
    240 The number indicates the fold level.  A zero cannot be used (a marker with
    241 level zero is ignored).  You can use "}}}" with a digit to indicate the level
    242 of the fold that ends.  The fold level of the following line will be one less
    243 than the indicated level.  Note that Vim doesn't look back to the level of the
    244 matching marker (that would take too much time).  Example: >
    245 
    246 {{{1
    247 fold level here is 1
    248 {{{3
    249 fold level here is 3
    250 }}}3
    251 fold level here is 2
    252 
    253 You can also use matching pairs of "{{{" and "}}}" markers to define folds.
    254 Each "{{{" increases the fold level by one, each "}}}" decreases the fold
    255 level by one.  Be careful to keep the markers matching!  Example: >
    256 
    257 {{{
    258 fold level here is 1
    259 {{{
    260 fold level here is 2
    261 }}}
    262 fold level here is 1
    263 
    264 You can mix using markers with a number and without a number.  A useful way of
    265 doing this is to use numbered markers for large folds, and unnumbered markers
    266 locally in a function.  For example use level one folds for the sections of
    267 your file like "structure definitions", "local variables" and "functions".
    268 Use level 2 markers for each definition and function,  Use unnumbered markers
    269 inside functions.  When you make changes in a function to split up folds, you
    270 don't have to renumber the markers.
    271 
    272 The markers can be set with the 'foldmarker' option.  It is recommended to
    273 keep this at the default value of "{{{,}}}", so that files can be exchanged
    274 between Vim users.  Only change it when it is required for the file (e.g., it
    275 contains markers from another folding editor, or the default markers cause
    276 trouble for the language of the file).
    277 
    278 						*fold-create-marker*
    279 "zf" can be used to create a fold defined by markers.  Vim will insert the
    280 markers for you.  Vim will append the start and end marker, as specified with
    281 'foldmarker'.  The markers are appended to the end of the line.
    282 'commentstring' is used if it isn't empty.
    283 This does not work properly when:
    284 - The line already contains a marker with a level number.  Vim then doesn't
    285  know what to do.
    286 - Folds nearby use a level number in their marker which gets in the way.
    287 - The line is inside a comment, 'commentstring' isn't empty and nested
    288  comments don't work.  For example with C: adding `/* {{{ */` inside a comment
    289  will truncate the existing comment.  Either put the marker before or after
    290  the comment, or add the marker manually.
    291 Generally it's not a good idea to let Vim create markers when you already have
    292 markers with a level number.
    293 
    294 						*fold-delete-marker*
    295 "zd" can be used to delete a fold defined by markers.  Vim will delete the
    296 markers for you.  Vim will search for the start and end markers, as specified
    297 with 'foldmarker', at the start and end of the fold.  When the text around the
    298 marker matches with 'commentstring', that text is deleted as well.
    299 This does not work properly when:
    300 - A line contains more than one marker and one of them specifies a level.
    301  Only the first one is removed, without checking if this will have the
    302  desired effect of deleting the fold.
    303 - The marker contains a level number and is used to start or end several folds
    304  at the same time.
    305 
    306 ==============================================================================
    307 2. Fold commands				*fold-commands* *E490*
    308 
    309 All folding commands start with "z".  Hint: the "z" looks like a folded piece
    310 of paper, if you look at it from the side.
    311 
    312 
    313 CREATING AND DELETING FOLDS ~
    314 						*zf* *E350*
    315 zf{motion}  or
    316 {Visual}zf	Operator to create a fold.
    317 	This only works when 'foldmethod' is "manual" or "marker".
    318 	The new fold will be closed for the "manual" method.
    319 	'foldenable' will be set.
    320 	Also see |fold-create-marker|.
    321 
    322 						*zF*
    323 zF		Create a fold for [count] lines.  Works like "zf".
    324 
    325 :{range}fo[ld]						*:fold* *:fo*
    326 	Create a fold for the lines in {range}.  Works like "zf".
    327 
    328 						*zd* *E351*
    329 zd		Delete one fold at the cursor.  When the cursor is on a folded
    330 	line, that fold is deleted.  Nested folds are moved one level
    331 	up.  In Visual mode one level of all folds (partially) in the
    332 	selected area are deleted.
    333 	Careful: This easily deletes more folds than you expect and
    334 	there is no undo for manual folding.
    335 	This only works when 'foldmethod' is "manual" or "marker".
    336 	Also see |fold-delete-marker|.
    337 
    338 						*zD*
    339 zD		Delete folds recursively at the cursor.  In Visual mode all
    340 	folds (partially) in the selected area and all nested folds in
    341 	them are deleted.
    342 	This only works when 'foldmethod' is "manual" or "marker".
    343 	Also see |fold-delete-marker|.
    344 
    345 						*zE* *E352*
    346 zE		Eliminate all folds in the window.
    347 	This only works when 'foldmethod' is "manual" or "marker".
    348 	Also see |fold-delete-marker|.
    349 
    350 
    351 OPENING AND CLOSING FOLDS ~
    352 
    353 A fold smaller than 'foldminlines' will always be displayed like it was open.
    354 Therefore the commands below may work differently on small folds.
    355 
    356 						*zo*
    357 zo		Open one fold under the cursor.  When a count is given, that
    358 	many folds deep will be opened.  In Visual mode one level of
    359 	folds is opened for all lines in the selected area.
    360 
    361 						*zO*
    362 zO		Open all folds under the cursor recursively.  Folds that don't
    363 	contain the cursor line are unchanged.
    364 	In Visual mode it opens all folds that are in the selected
    365 	area, also those that are only partly selected.
    366 
    367 						*zc*
    368 zc		Close one fold under the cursor.  When a count is given, that
    369 	many folds deep are closed.  In Visual mode one level of folds
    370 	is closed for all lines in the selected area.
    371 	'foldenable' will be set.
    372 
    373 						*zC*
    374 zC		Close all folds under the cursor recursively.  Folds that
    375 	don't contain the cursor line are unchanged.
    376 	In Visual mode it closes all folds that are in the selected
    377 	area, also those that are only partly selected.
    378 	'foldenable' will be set.
    379 
    380 						*za*
    381 za		Summary: Toggle the fold under the cursor.
    382 	When on a closed fold: open it.  When folds are nested, you
    383 	may have to use "za" several times.  When a count is given,
    384 	that many closed folds are opened.
    385 	When on an open fold: close it and set 'foldenable'.  This
    386 	will only close one level, since using "za" again will open
    387 	the fold.  When a count is given that many folds will be
    388 	closed (that's not the same as repeating "za" that many
    389 	times).
    390 
    391 						*zA*
    392 zA		When on a closed fold: open it recursively.
    393 	When on an open fold: close it recursively and set
    394 	'foldenable'.
    395 
    396 						*zv*
    397 zv		View cursor line: Open just enough folds to make the line in
    398 	which the cursor is located not folded.
    399 
    400 						*zx*
    401 zx		Update folds: Undo manually opened and closed folds: re-apply
    402 	'foldlevel', then do "zv": View cursor line.
    403 	Also forces recomputing folds.  This is useful when using
    404 	'foldexpr' and the buffer is changed in a way that results in
    405 	folds not to be updated properly.
    406 
    407 						*zX*
    408 zX		Undo manually opened and closed folds: re-apply 'foldlevel'.
    409 	Also forces recomputing folds, like |zx|.
    410 
    411 						*zm*
    412 zm		Fold more: Subtract |v:count1| from 'foldlevel'.  If
    413 	'foldlevel' was already zero nothing happens.
    414 	'foldenable' will be set.
    415 
    416 						*zM*
    417 zM		Close all folds: set 'foldlevel' to 0.
    418 	'foldenable' will be set.
    419 
    420 						*zr*
    421 zr		Reduce folding: Add |v:count1| to 'foldlevel'.
    422 
    423 						*zR*
    424 zR		Open all folds.  This sets 'foldlevel' to highest fold level.
    425 
    426 						*:foldo* *:foldopen*
    427 :{range}foldo[pen][!]
    428 	Open folds in {range}.  When [!] is added all folds are
    429 	opened.  Useful to see all the text in {range}.  Without [!]
    430 	one level of folds is opened.
    431 
    432 						*:foldc* *:foldclose*
    433 :{range}foldc[lose][!]
    434 	Close folds in {range}.  When [!] is added all folds are
    435 	closed.  Useful to hide all the text in {range}.  Without [!]
    436 	one level of folds is closed.
    437 
    438 						*zn*
    439 zn		Fold none: reset 'foldenable'.  All folds will be open.
    440 
    441 						*zN*
    442 zN		Fold normal: set 'foldenable'.  All folds will be as they
    443 	were before.
    444 
    445 						*zi*
    446 zi		Invert 'foldenable'.
    447 
    448 
    449 MOVING OVER FOLDS ~
    450 						*[z*
    451 [z		Move to the start of the current open fold.  If already at the
    452 	start, move to the start of the fold that contains it.  If
    453 	there is no containing fold, the command fails.
    454 	When a count is used, repeats the command [count] times.
    455 
    456 						*]z*
    457 ]z		Move to the end of the current open fold.  If already at the
    458 	end, move to the end of the fold that contains it.  If there
    459 	is no containing fold, the command fails.
    460 	When a count is used, repeats the command [count] times.
    461 
    462 						*zj*
    463 zj		Move downwards to the start of the next fold.  A closed fold
    464 	is counted as one fold.
    465 	When a count is used, repeats the command [count] times.
    466 	This command can be used after an |operator|.
    467 
    468 						*zk*
    469 zk		Move upwards to the end of the previous fold.  A closed fold
    470 	is counted as one fold.
    471 	When a count is used, repeats the command [count] times.
    472 	This command can be used after an |operator|.
    473 
    474 
    475 EXECUTING COMMANDS ON FOLDS ~
    476 
    477 :[range]foldd[oopen] {cmd}		*:foldd* *:folddo* *:folddoopen*
    478 	Execute {cmd} on all lines that are not in a closed fold.
    479 	When [range] is given, only these lines are used.
    480 	Each time {cmd} is executed the cursor is positioned on the
    481 	line it is executed for.
    482 	This works like the ":global" command: First all lines that
    483 	are not in a closed fold are marked.  Then the {cmd} is
    484 	executed for all marked lines.  Thus when {cmd} changes the
    485 	folds, this has no influence on where it is executed (except
    486 	when lines are deleted, of course).
    487 	Example: >
    488 		:folddoopen s/end/loop_end/ge
    489 <		Note the use of the "e" flag to avoid getting an error message
    490 	where "end" doesn't match.
    491 
    492 :[range]folddoc[losed] {cmd}			*:folddoc* *:folddoclosed*
    493 	Execute {cmd} on all lines that are in a closed fold.
    494 	Otherwise like ":folddoopen".
    495 
    496 ==============================================================================
    497 3. Fold options					*fold-options*
    498 
    499 COLORS							*fold-colors*
    500 
    501 The colors of a closed fold are set with the Folded group |hl-Folded|.  The
    502 colors of the fold column are set with the FoldColumn group |hl-FoldColumn|.
    503 Example to set the colors: >
    504 
    505 :highlight Folded guibg=grey guifg=blue
    506 :highlight FoldColumn guibg=darkgrey guifg=white
    507 
    508 
    509 FOLDLEVEL						*fold-foldlevel*
    510 
    511 'foldlevel' is a number option: The higher the more folded regions are open.
    512 When 'foldlevel' is 0, all folds are closed.
    513 When 'foldlevel' is positive, some folds are closed.
    514 When 'foldlevel' is very high, all folds are open.
    515 'foldlevel' is applied when it is changed.  After that manually folds can be
    516 opened and closed.
    517 When increased, folds above the new level are opened.  No manually opened
    518 folds will be closed.
    519 When decreased, folds above the new level are closed.  No manually closed
    520 folds will be opened.
    521 
    522 
    523 FOLDTEXT						*fold-foldtext*
    524 
    525 'foldtext' is a string option that specifies an expression.  This expression
    526 is evaluated to obtain the text displayed for a closed fold.  Example: >
    527 
    528    :set foldtext=v:folddashes.substitute(getline(v:foldstart),'/\\*\\\|\\*/\\\|{{{\\d\\=','','g')
    529 
    530 This shows the first line of the fold, with "/*", "*/" and "{{{" removed.
    531 Note the use of backslashes to avoid some characters to be interpreted by the
    532 ":set" command.  It is much simpler to define a function and call it: >
    533 
    534    :set foldtext=MyFoldText()
    535    :function MyFoldText()
    536    :  let line = getline(v:foldstart)
    537    :  let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g')
    538    :  return v:folddashes .. sub
    539    :endfunction
    540 
    541 Evaluating 'foldtext' is done in the |sandbox|.  The current window is set to
    542 the window that displays the line.
    543 
    544 Errors are ignored.  For debugging set the 'debug' option to "throw".
    545 
    546 The default value is |foldtext()|.  This returns a reasonable text for most
    547 types of folding.  If you don't like it, you can specify your own 'foldtext'
    548 expression.  It can use these special Vim variables:
    549 v:foldstart	line number of first line in the fold
    550 v:foldend	line number of last line in the fold
    551 v:folddashes	a string that contains dashes to represent the
    552 		foldlevel.
    553 v:foldlevel	the foldlevel of the fold
    554 
    555 If the result is a |List|, it is parsed and drawn like "overlay" virtual text
    556 (see |nvim_buf_set_extmark()|), otherwise the result is converted to a string
    557 where a TAB is replaced with a space and unprintable characters are made into
    558 printable characters.
    559 
    560 The resulting line is truncated to fit in the window, it never wraps.
    561 When there is room after the text, it is filled with the character specified
    562 by 'fillchars'.
    563 
    564 If the 'foldtext' expression starts with s: or |<SID>|, then it is replaced
    565 with the script ID (|local-function|).  Examples: >
    566 	set foldtext=s:MyFoldText()
    567 	set foldtext=<SID>SomeFoldText()
    568 <
    569 Note that backslashes need to be used for characters that the ":set" command
    570 handles differently: Space, backslash and double-quote. |option-backslash|
    571 
    572 
    573 FOLDCOLUMN						*fold-foldcolumn*
    574 
    575 'foldcolumn' is a number, which sets the width for a column on the side of the
    576 window to indicate folds.  When it is zero, there is no foldcolumn.  A normal
    577 value is auto:9. The maximum is 9.
    578 
    579 An open fold is indicated with a column that has a '-' at the top and '|'
    580 characters below it.  This column stops where the open fold stops.  When folds
    581 nest, the nested fold is one character right of the fold it's contained in.
    582 
    583 A closed fold is indicated with a '+'.
    584 
    585 These characters can be changed with the 'fillchars' option.
    586 
    587 Where the fold column is too narrow to display all nested folds, digits are
    588 shown to indicate the nesting level.  To override this behavior you can use
    589 the "foldinner" character of the 'fillchars' option.
    590 
    591 The mouse can also be used to open and close folds by clicking in the
    592 fold column:
    593 - Click on a '+' to open the closed fold at this row.
    594 - Click on any other non-blank character to close the open fold at this row.
    595 
    596 
    597 OTHER OPTIONS
    598 
    599 'foldenable'  'fen':	Open all folds while not set.
    600 'foldexpr'    'fde':	Expression used for "expr" folding.
    601 'foldignore'  'fdi':	Characters used for "indent" folding.
    602 'foldmarker'  'fmr':	Defined markers used for "marker" folding.
    603 'foldmethod'  'fdm':	Name of the current folding method.
    604 'foldminlines' 'fml':	Minimum number of screen lines for a fold to be
    605 		displayed closed.
    606 'foldnestmax' 'fdn':	Maximum nesting for "indent" and "syntax" folding.
    607 'foldopen'    'fdo':	Which kinds of commands open closed folds.
    608 'foldclose'   'fcl':	When the folds not under the cursor are closed.
    609 
    610 ==============================================================================
    611 4. Behavior of folds					*fold-behavior*
    612 
    613 When moving the cursor upwards or downwards and when scrolling, the cursor
    614 will move to the first line of a sequence of folded lines.  When the cursor is
    615 already on a folded line, it moves to the next unfolded line or the next
    616 closed fold.
    617 
    618 While the cursor is on folded lines, the cursor is always displayed in the
    619 first column.  The ruler does show the actual cursor position, but since the
    620 line is folded, it cannot be displayed there.
    621 
    622 Many movement commands handle a sequence of folded lines like an empty line.
    623 For example, the "w" command stops once in the first column.
    624 
    625 When starting a search in a closed fold it will not find a match in the
    626 current fold.  It's like a forward search always starts from the end of the
    627 closed fold, while a backwards search starts from the start of the closed
    628 fold.
    629 
    630 When in Insert mode, the cursor line is never folded.  That allows you to see
    631 what you type!
    632 
    633 When using an operator, a closed fold is included as a whole.  Thus "dl"
    634 deletes the whole closed fold under the cursor.
    635 
    636 For Ex commands that operate on buffer lines, the range is adjusted to always
    637 start at the first line of a closed fold and end at the last line of a closed
    638 fold.  Thus, this command: >
    639 :s/foo/bar/g
    640 when used with the cursor on a closed fold, will replace "foo" with "bar" in
    641 all lines of the fold.
    642 This does not happen for |:folddoopen| and |:folddoclosed|.
    643 
    644 Note that for some Ex commands like |:source| the range is only adjusted when
    645 using a two line specifiers [range].
    646 
    647 When editing a buffer that has been edited before, the last used folding
    648 settings are used again.  For manual folding the defined folds are restored.
    649 For all folding methods the manually opened and closed folds are restored.
    650 If this buffer has been edited in this window, the values from back then are
    651 used.  Otherwise the values from the window where the buffer was edited last
    652 are used.
    653 
    654 vim:tw=78:ts=8:noet:ft=help:norl: