aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/lua.txt
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2025-03-26 05:49:48 -0700
committerGitHub <noreply@github.com>2025-03-26 05:49:48 -0700
commit8a7e1b19b9bf6cf3d081ca9d87bbe0045f93d556 (patch)
tree7fec31d6f4badb3e4c51fc09112e9ed757bd43a0 /runtime/doc/lua.txt
parent6b00c9acfde954a3e992a2932eca9fa5902a1298 (diff)
downloadrneovim-8a7e1b19b9bf6cf3d081ca9d87bbe0045f93d556.tar.gz
rneovim-8a7e1b19b9bf6cf3d081ca9d87bbe0045f93d556.tar.bz2
rneovim-8a7e1b19b9bf6cf3d081ca9d87bbe0045f93d556.zip
docs: news, lsp autocomplete #33047
Diffstat (limited to 'runtime/doc/lua.txt')
-rw-r--r--runtime/doc/lua.txt18
1 files changed, 7 insertions, 11 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 86cfc56693..feaf78f314 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -435,18 +435,12 @@ where the args are converted to Lua values. The expression >vim
is equivalent to the Lua chunk >lua
return somemod.func(...)
-In addition, functions of packages can be accessed like >vim
+Lua module functions can be accessed like: >vim
call v:lua.require'mypack'.func(arg1, arg2)
call v:lua.require'mypack.submod'.func(arg1, arg2)
Note: Only single quote form without parens is allowed. Using
-`require"mypack"` or `require('mypack')` as prefixes do NOT work (the latter
-is still valid as a function call of itself, in case require returns a useful
-value).
+`require"mypack"` or `require('mypack')` as a prefix does NOT work.
-The `v:lua` prefix may be used to call Lua functions as |method|s. For
-example: >vim
- :eval arg1->v:lua.somemod.func(arg2)
-<
You can use `v:lua` in "func" options like 'tagfunc', 'omnifunc', etc.
For example consider the following Lua omnifunc handler: >lua
@@ -457,11 +451,13 @@ For example consider the following Lua omnifunc handler: >lua
return {'stuff', 'steam', 'strange things'}
end
end
+ -- Note: The module ("mymod") must be a Lua global, or use require() as
+ -- shown above to access it from a package.
vim.bo[buf].omnifunc = 'v:lua.mymod.omnifunc'
-Note: The module ("mymod" in the above example) must either be a Lua global,
-or use require() as shown above to access it from a package.
-
+You can also use `v:lua` to call Lua functions as Vimscript |method|s: >vim
+ :eval arg1->v:lua.somemod.func(arg2)
+<
Note: `v:lua` without a call is not allowed in a Vimscript expression:
|Funcref|s cannot represent Lua functions. The following are errors: >vim