Mercurial > vim
diff runtime/doc/if_lua.txt @ 25527:d5e9c05b4811 v8.2.3300
patch 8.2.3300: Lua: can only execute on Vim command at a time
Commit: https://github.com/vim/vim/commit/11328bc7df0ecc47f4025a10bb86882a659e9994
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Fri Aug 6 21:34:38 2021 +0200
patch 8.2.3300: Lua: can only execute on Vim command at a time
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 06 Aug 2021 21:45:05 +0200 |
parents | 9947b7e4b319 |
children | 29ec2c198c8d |
line wrap: on
line diff
--- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -175,10 +175,17 @@ Vim evaluation and command execution, an :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, an 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