aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/fold.txt
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-01-25 18:31:31 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-01-25 18:31:31 +0000
commit9243becbedbb6a1592208051f8fa2b090dcc5e7d (patch)
tree607c2a862ec3f4399b8766383f6f8e04c4aa43b4 /runtime/doc/fold.txt
parent9e40b6e9e1bc67f2d856adb837ee64dd0e25b717 (diff)
parent3c48d3c83fc21dbc0841f9210f04bdb073d73cd1 (diff)
downloadrneovim-usermarks.tar.gz
rneovim-usermarks.tar.bz2
rneovim-usermarks.zip
Merge remote-tracking branch 'upstream/master' into usermarksusermarks
Diffstat (limited to 'runtime/doc/fold.txt')
-rw-r--r--runtime/doc/fold.txt17
1 files changed, 16 insertions, 1 deletions
diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt
index 9e3d78faff..35a3be35fb 100644
--- a/runtime/doc/fold.txt
+++ b/runtime/doc/fold.txt
@@ -116,6 +116,11 @@ method can be very slow!
Try to avoid the "=", "a" and "s" return values, since Vim often has to search
backwards for a line for which the fold level is defined. This can be slow.
+If the 'foldexpr' expression starts with s: or |<SID>|, then it is replaced
+with the script ID (|local-function|). Examples: >
+ set foldexpr=s:MyFoldExpr()
+ set foldexpr=<SID>SomeFoldExpr()
+<
An example of using "a1" and "s1": For a multi-line C comment, a line
containing "/*" would return "a1" to start a fold, and a line containing "*/"
would return "s1" to end the fold after that line: >
@@ -491,7 +496,7 @@ is evaluated to obtain the text displayed for a closed fold. Example: >
This shows the first line of the fold, with "/*", "*/" and "{{{" removed.
Note the use of backslashes to avoid some characters to be interpreted by the
-":set" command. It's simpler to define a function and call that: >
+":set" command. It is much simpler to define a function and call it: >
:set foldtext=MyFoldText()
:function MyFoldText()
@@ -521,6 +526,11 @@ 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|
@@ -576,6 +586,11 @@ line is folded, it cannot be displayed there.
Many movement commands handle a sequence of folded lines like an empty line.
For example, the "w" command stops once in the first column.
+When starting a search in a closed fold it will not find a match in the
+current fold. It's like a forward search always starts from the end of the
+closed fold, while a backwards search starts from the start of the closed
+fold.
+
When in Insert mode, the cursor line is never folded. That allows you to see
what you type!