summaryrefslogtreecommitdiffstats
path: root/runtime/doc/if_lua.txt
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2021-08-06 21:34:38 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-06 21:34:38 +0200
commit11328bc7df0ecc47f4025a10bb86882a659e9994 (patch)
treeb079094f517cb0059686d866ee691bc3bfbd4c03 /runtime/doc/if_lua.txt
parent5671f3f076573fa9133bc210d6580067698d9a1b (diff)
patch 8.2.3300: Lua: can only execute on Vim command at a timev8.2.3300
Problem: Lua: can only execute on Vim command at a time. Not easy to get the Vim version. Solution: Make vim.command() accept multiple lines. Add vim.version(). (Yegappan Lakshmanan, closes #8716)
Diffstat (limited to 'runtime/doc/if_lua.txt')
-rw-r--r--runtime/doc/if_lua.txt15
1 files changed, 14 insertions, 1 deletions
diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt
index cb68eefe00..f3bb0ce7a7 100644
--- a/runtime/doc/if_lua.txt
+++ b/runtime/doc/if_lua.txt
@@ -175,10 +175,17 @@ Vim evaluation and command execution, and others.
:lua print(type(l), vim.type(l))
:" list
<
- vim.command({cmd}) Executes the vim (ex-mode) command {cmd}.
+ vim.command({cmds}) Executes one or more lines of Ex-mode commands
+ in {cmds}.
Examples: >
:lua vim.command"set tw=60"
:lua vim.command"normal ddp"
+ lua << trim END
+ vim.command([[
+ new Myfile.js
+ call search('start')
+ ]])
+ END
<
vim.eval({expr}) Evaluates expression {expr} (see |expression|),
converts the result to Lua, and returns it.
@@ -211,6 +218,12 @@ Vim evaluation and command execution, and others.
vim.lua_version The Lua version Vim was compiled with, in the
form {major}.{minor}.{patch}, e.g. "5.1.4".
+ vim.version() Returns a Lua table with the Vim version.
+ The table will have the following keys:
+ major - major Vim version.
+ minor - minor Vim version.
+ patch - latest patch included.
+
*lua-vim-variables*
The Vim editor global dictionaries |g:| |w:| |b:| |t:| |v:| can be accessed
from Lua conveniently and idiomatically by referencing the `vim.*` Lua tables