doc: Vim internal variables & options in lua (#12302)

* doc: Add info about vim dicts in lua

* doc: preamble and info

* doc: remove weird spacing

* fixup
This commit is contained in:
TJ DeVries
2020-05-17 23:29:34 -04:00
committed by GitHub
parent a91ce497b4
commit a6be7a9180

View File

@@ -849,6 +849,66 @@ vim.types *vim.types*
`vim.types.dictionary` will not change or that `vim.types` table will
only contain values for these three types.
==============================================================================
Vim Internal Variables *lua-vim-internal-variables*
Built-in Vim dictionaries can be accessed and set idiomatically in Lua by each
of the following tables.
To set a value: >
vim.g.my_global_variable = 5
<
To read a value: >
print(vim.g.my_global_variable)
<
To delete a value: >
vim.g.my_global_variable = nil
<
vim.g *vim.g*
Table with values from |g:|
Keys with no values set will result in `nil`.
vim.b *vim.b*
Gets a buffer-scoped (b:) variable for the current buffer.
Keys with no values set will result in `nil`.
vim.w *vim.w*
Gets a window-scoped (w:) variable for the current window.
Keys with no values set will result in `nil`.
vim.t *vim.t*
Gets a tabpage-scoped (t:) variable for the current table.
Keys with no values set will result in `nil`.
vim.v *vim.v*
Gets a v: variable.
Keys with no values set will result in `nil`.
Vim Internal Options *lua-vim-internal-options*
Read, set and clear vim |options| in Lua by each of the following tables.
vim.o *vim.o*
Table with values from |options|
Invalid keys will result in an error.
vim.bo *vim.bo*
Gets a buffer-scoped option for the current buffer.
Invalid keys will result in an error.
vim.wo *vim.wo*
Gets a window-scoped option for the current window.
Invalid keys will result in an error.
==============================================================================
Lua module: vim *lua-vim*