diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-02-18 17:50:47 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-18 17:50:47 +0000 |
commit | 1fca5f3e86f08e696058fc7e86dfe41b415a78e6 (patch) | |
tree | 533fd7d2f262b2d4238be66a00327b13e979e4cb /runtime | |
parent | b8fb5bb68d45f3e52bb9ea201dc9e7dc6b6d2c6d (diff) |
patch 8.2.4416: Vim9: using a script-local function requires using "s:"v8.2.4416
Problem: Vim9: using a script-local function requires using "s:" when
setting 'completefunc'.
Solution: Do not require "s:" in Vim9 script. (closes #9796)
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/options.txt | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 1d3f76864b..8fcbc99c40 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -383,12 +383,22 @@ lambda it will be converted to the name, e.g. "<lambda>123". Examples: set opfunc=function('MyOpFunc') set opfunc=funcref('MyOpFunc') set opfunc={a\ ->\ MyOpFunc(a)} - " set using a funcref variable + +Set to a script-local function: > + set opfunc=s:MyLocalFunc + set opfunc=<SID>MyLocalFunc +In |Vim9| script the "s:" and "<SID>" can be omitted if the function exists in +the script: > + set opfunc=MyLocalFunc + +Set using a funcref variable: > let Fn = function('MyTagFunc') let &tagfunc = Fn - " set using a lambda expression + +Set using a lambda expression: > let &tagfunc = {t -> MyTagFunc(t)} - " set using a variable with lambda expression + +Set using a variable with lambda expression: > let L = {a, b, c -> MyTagFunc(a, b , c)} let &tagfunc = L |