diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2021-12-26 10:51:39 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-12-26 10:51:39 +0000 |
commit | 8bb65f230d3025037f34021a72616038da0601ee (patch) | |
tree | 1edaf57b7fbe5e3c30a174026f5389f8b98b7376 /runtime | |
parent | ec86520f946a40d5c4a92d6a11d6928faa13abd4 (diff) |
patch 8.2.3900: it is not easy to use a script-local function for an optionv8.2.3900
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)
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/diff.txt | 10 | ||||
-rw-r--r-- | runtime/doc/fold.txt | 7 | ||||
-rw-r--r-- | runtime/doc/options.txt | 20 | ||||
-rw-r--r-- | runtime/doc/print.txt | 5 |
4 files changed, 42 insertions, 0 deletions
diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index 2a231b15bb..e3d8f53c46 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -398,6 +398,11 @@ mode, so that a CTRL-Z doesn't end the text on DOS. The `redraw!` command may not be needed, depending on whether executing a shell command shows something on the display or not. +If the 'diffexpr' expression starts with s: or |<SID>|, then it is replaced +with the script ID (|local-function|). Example: > + set diffexpr=s:MyDiffExpr() + set diffexpr=<SID>SomeDiffExpr() +< *E810* *E97* Vim will do a test if the diff output looks alright. If it doesn't, you will get an error message. Possible causes: @@ -449,4 +454,9 @@ evaluating 'patchexpr'. This hopefully avoids that files in the current directory are accidentally patched. Vim will also delete files starting with v:fname_in and ending in ".rej" and ".orig". +If the 'patchexpr' expression starts with s: or |<SID>|, then it is replaced +with the script ID (|local-function|). Example: > + set patchexpr=s:MyPatchExpr() + set patchexpr=<SID>SomePatchExpr() +< vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt index 274e472a5d..56c3c75c35 100644 --- a/runtime/doc/fold.txt +++ b/runtime/doc/fold.txt @@ -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. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 845351d08f..f0939e61bb 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1225,6 +1225,11 @@ A jump table for the options with a short description can be found at |Q_op|. Vim does not try to send a message to an external debugger (Netbeans or Sun Workshop). + If the expression starts with s: or |<SID>|, then it is replaced with + the script ID (|local-function|). Example: > + set bexpr=s:MyBalloonExpr() + set bexpr=<SID>SomeBalloonExpr() +< The expression will be evaluated in the |sandbox| when set from a modeline, see |sandbox-option|. This option cannot be set in a modeline when 'modelineexpr' is off. @@ -3596,6 +3601,11 @@ A jump table for the options with a short description can be found at |Q_op|. When the expression evaluates to non-zero Vim will fall back to using the internal format mechanism. + If the expression starts with s: or |<SID>|, then it is replaced with + the script ID (|local-function|). Example: > + set formatexpr=s:MyFormatExpr() + set formatexpr=<SID>SomeFormatExpr() +< The expression will be evaluated in the |sandbox| when set from a modeline, see |sandbox-option|. That stops the option from working, since changing the buffer text is not allowed. @@ -4438,6 +4448,11 @@ A jump table for the options with a short description can be found at |Q_op|. found. Allows doing "gf" on the name after an 'include' statement. Also used for |<cfile>|. + If the expression starts with s: or |<SID>|, then it is replaced with + the script ID (|local-function|). Example: > + set includeexpr=s:MyIncludeExpr(v:fname) + set includeexpr=<SID>SomeIncludeExpr(v:fname) +< The expression will be evaluated in the |sandbox| when set from a modeline, see |sandbox-option|. This option cannot be set in a modeline when 'modelineexpr' is off. @@ -4511,6 +4526,11 @@ A jump table for the options with a short description can be found at |Q_op|. The expression is evaluated with |v:lnum| set to the line number for which the indent is to be computed. The cursor is also in this line when the expression is evaluated (but it may be moved around). + If the expression starts with s: or |<SID>|, then it is replaced with + the script ID (|local-function|). Example: > + set indentexpr=s:MyIndentExpr() + set indentexpr=<SID>SomeIndentExpr() +< The expression must return the number of spaces worth of indent. It can return "-1" to keep the current indent (this means 'autoindent' is used for the indent). diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt index aaa004c93e..eebdf7ea02 100644 --- a/runtime/doc/print.txt +++ b/runtime/doc/print.txt @@ -174,6 +174,11 @@ an error message. In that case Vim will delete the file. In the default value for non-MS-Windows a trick is used: Adding "v:shell_error" will result in a non-zero number when the system() call fails. +If the expression starts with s: or |<SID>|, then it is replaced with the +script ID (|local-function|). Example: > + set printexpr=s:MyPrintFile() + set printexpr=<SID>SomePrintFile() +< This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. |