aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-04 20:41:01 +0800
committerGitHub <noreply@github.com>2022-09-04 20:41:01 +0800
commit900a7741821ff8dfb0634290a343e501955e9a1a (patch)
tree09b0e9b6637ebc04a51bd5df89d180651e415226
parent24fbda04b9e9537577220e1f5bf7d2934d94191d (diff)
parent21dad0dcf34330cfd7c765485b19d0ac46ce8565 (diff)
downloadrneovim-900a7741821ff8dfb0634290a343e501955e9a1a.tar.gz
rneovim-900a7741821ff8dfb0634290a343e501955e9a1a.tar.bz2
rneovim-900a7741821ff8dfb0634290a343e501955e9a1a.zip
Merge pull request #20073 from zeertzjq/vim-088e8e344352
vim-patch:7.4.{1578,1624},088e8e344352
-rw-r--r--runtime/doc/builtin.txt30
-rw-r--r--runtime/doc/eval.txt5
-rw-r--r--runtime/doc/quickref.txt1
3 files changed, 34 insertions, 2 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index a2e15142e7..3ca6f04389 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -2507,10 +2507,11 @@ funcref({name} [, {arglist}] [, {dict}])
Can also be used as a |method|: >
GetFuncname()->funcref([arg])
<
- *function()* *E700* *E922* *E923*
+ *function()* *partial* *E700* *E922* *E923*
function({name} [, {arglist}] [, {dict}])
Return a |Funcref| variable that refers to function {name}.
- {name} can be a user defined function or an internal function.
+ {name} can be the name of a user defined function or an
+ internal function.
{name} can also be a Funcref or a partial. When it is a
partial the dict stored in it will be used and the {dict}
@@ -2536,6 +2537,27 @@ function({name} [, {arglist}] [, {dict}])
< Invokes the function as with: >
call Callback('one', 'two', 'name')
+< With a |method|: >
+ func Callback(one, two, three)
+ ...
+ let Partial = function('Callback', ['two'])
+ ...
+ eval 'one'->Partial('three')
+< Invokes the function as with: >
+ call Callback('one', 'two', 'three')
+
+< The function() call can be nested to add more arguments to the
+ Funcref. The extra arguments are appended to the list of
+ arguments. Example: >
+ func Callback(arg1, arg2, name)
+ ...
+ let Func = function('Callback', ['one'])
+ let Func2 = function(Func, ['two'])
+ ...
+ call Func2('name')
+< Invokes the function as with: >
+ call Callback('one', 'two', 'name')
+
< The Dictionary is only useful when calling a "dict" function.
In that case the {dict} is passed in as "self". Example: >
function Callback() dict
@@ -2546,6 +2568,10 @@ function({name} [, {arglist}] [, {dict}])
let Func = function('Callback', context)
...
call Func() " will echo: called for example
+< The use of function() is not needed when there are no extra
+ arguments, these two are equivalent: >
+ let Func = function('Callback', context)
+ let Func = context.Callback
< The argument list and the Dictionary can be combined: >
function Callback(arg1, count) dict
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 3fbf1ee136..bce0189cfb 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2622,6 +2622,11 @@ It is also possible to use `:eval`. It does not support a range, but does
allow for method chaining, e.g.: >
eval GetList()->Filter()->append('$')
+A function can also be called as part of evaluating an expression or when it
+is used as a method: >
+ let x = GetList()
+ let y = GetList()->Filter()
+
AUTOMATICALLY LOADING FUNCTIONS ~
*autoload-functions*
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index 6f16db5cc2..9f3993506a 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -649,6 +649,7 @@ Short explanation of each option: *option-list*
'complete' 'cpt' specify how Insert mode completion works
'completefunc' 'cfu' function to be used for Insert mode completion
'completeopt' 'cot' options for Insert mode completion
+'completeslash' 'csl' like 'shellslash' for completion
'concealcursor' 'cocu' whether concealable text is hidden in cursor line
'conceallevel' 'cole' whether concealable text is shown or hidden
'confirm' 'cf' ask what to do about unsaved/read-only files