patch 8.2.3900: it is not easy to use a script-local function for an option

Problem:    It is not easy to use a script-local function for an option.
Solution:   recognize s: and <SID> at the start of the expression. (Yegappan
            Lakshmanan, closes #9401)
This commit is contained in:
Yegappan Lakshmanan
2021-12-26 10:51:39 +00:00
committed by Bram Moolenaar
parent ec86520f94
commit 8bb65f230d
13 changed files with 265 additions and 8 deletions

View File

@ -121,6 +121,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|). Example: >
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: >
@ -543,6 +548,8 @@ A closed fold is indicated with a '+'.
These characters can be changed with the 'fillchars' option.
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.