aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2022-07-20 12:29:24 +0100
committerGitHub <noreply@github.com>2022-07-20 12:29:24 +0100
commit559ef3e90393a8f02c8350a9d60f4b7849815d97 (patch)
tree7175f0b57198081c0e86e0ef3b5c77efaf582daa /runtime/doc
parent243038188bc74c008e36fc005aa18dc23d7ae3f0 (diff)
downloadrneovim-559ef3e90393a8f02c8350a9d60f4b7849815d97.tar.gz
rneovim-559ef3e90393a8f02c8350a9d60f4b7849815d97.tar.bz2
rneovim-559ef3e90393a8f02c8350a9d60f4b7849815d97.zip
feat(lua): allow vim.cmd to be indexed (#19238)
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/lua.txt21
1 files changed, 20 insertions, 1 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index aeb1699908..0e58d1b1fe 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -1291,6 +1291,9 @@ Lua module: vim *lua-vim*
cmd({command}) *vim.cmd()*
Execute Vim script commands.
+ Note that `vim.cmd` can be indexed with a command name to
+ return a callable function to the command.
+
Example: >
vim.cmd('echo 42')
@@ -1300,7 +1303,23 @@ cmd({command}) *vim.cmd()*
autocmd FileType c setlocal cindent
augroup END
]])
- vim.cmd({ cmd = 'echo', args = { '"foo"' } })
+
+ -- Ex command :echo "foo"
+ -- Note string literals need to be double quoted.
+ vim.cmd('echo "foo"')
+ vim.cmd { cmd = 'echo', args = { '"foo"' } }
+ vim.cmd.echo({ args = { '"foo"' } })
+ vim.cmd.echo('"foo"')
+
+ -- Ex command :write! myfile.txt
+ vim.cmd('write! myfile.txt')
+ vim.cmd { cmd = 'write', args = { "myfile.txt" }, bang = true }
+ vim.cmd.write { args = { "myfile.txt" }, bang = true }
+ vim.cmd.write {"myfile.txt", bang = true })
+
+ -- Ex command :colorscheme blue
+ vim.cmd('colorscheme blue')
+ vim.cmd.colorscheme('blue')
<
Parameters: ~