aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2021-09-23 15:00:25 +0100
committerLewis Russell <lewis6991@gmail.com>2021-10-19 19:47:33 +0100
commit6c5e7bde9a1b207345787a60f6c37a325be26c64 (patch)
tree7164aeb001b69ab4d51853e32b16986ab70bc883 /runtime
parent064411ea7ff825aed3d4e01207914ed61d7ee79d (diff)
downloadrneovim-6c5e7bde9a1b207345787a60f6c37a325be26c64.tar.gz
rneovim-6c5e7bde9a1b207345787a60f6c37a325be26c64.tar.bz2
rneovim-6c5e7bde9a1b207345787a60f6c37a325be26c64.zip
feat(lua): allow passing handles to vim.b/w/t
vim.bo can target a specific buffer by indexing with a number, e.g: `vim.bo[2].filetype` can get/set the filetype for buffer 2. This change replicates that behaviour for the variable namespace.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/lua.txt10
1 files changed, 7 insertions, 3 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index a6ccf9f35c..f8576a05fe 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -928,6 +928,7 @@ Example: >
vim.g.foo = 5 -- Set the g:foo Vimscript variable.
print(vim.g.foo) -- Get and print the g:foo Vimscript variable.
vim.g.foo = nil -- Delete (:unlet) the Vimscript variable.
+ vim.b[2].foo = 6 -- Set b:foo for buffer 2
vim.g *vim.g*
Global (|g:|) editor variables.
@@ -935,15 +936,18 @@ vim.g *vim.g*
vim.b *vim.b*
Buffer-scoped (|b:|) variables for the current buffer.
- Invalid or unset key returns `nil`.
+ Invalid or unset key returns `nil`. Can be indexed with
+ an integer to access variables for a specific buffer.
vim.w *vim.w*
Window-scoped (|w:|) variables for the current window.
- Invalid or unset key returns `nil`.
+ Invalid or unset key returns `nil`. Can be indexed with
+ an integer to access variables for a specific window.
vim.t *vim.t*
Tabpage-scoped (|t:|) variables for the current tabpage.
- Invalid or unset key returns `nil`.
+ Invalid or unset key returns `nil`. Can be indexed with
+ an integer to access variables for a specific tabpage.
vim.v *vim.v*
|v:| variables.