diff options
| author | Michal Liszcz <liszcz.michal@gmail.com> | 2023-03-29 09:59:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-29 09:59:01 +0200 |
| commit | b7748662ed5b06c12a74560690b728fdf770666f (patch) | |
| tree | fbade6571fddb65539b9d0ea3d8f62e1a8306915 /runtime | |
| parent | eac75a971d042bd610310314e6c64097694ee418 (diff) | |
| download | rneovim-b7748662ed5b06c12a74560690b728fdf770666f.tar.gz rneovim-b7748662ed5b06c12a74560690b728fdf770666f.tar.bz2 rneovim-b7748662ed5b06c12a74560690b728fdf770666f.zip | |
fix(api): Use local LastSet structure in nvim_get_option_info (#22741)
fix(api): use local LastSet structure in nvim_get_option_info
* nvim_get_option_info is deprecated.
It is always using the global LastSet information as reported in #15232.
* nvim_get_option_info2 is added.
The new function additionally accepts an 'opts' table {scope, buf, win}
allowing to specify the option scope and query local options from another
buffer or window.
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/doc/api.txt | 17 | ||||
| -rw-r--r-- | runtime/doc/deprecated.txt | 1 |
2 files changed, 15 insertions, 3 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index ea57db22e0..b51da8d56f 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -1912,7 +1912,7 @@ nvim_get_all_options_info() *nvim_get_all_options_info()* Gets the option information for all options. The dictionary has the full option names as keys and option metadata - dictionaries as detailed at |nvim_get_option_info()|. + dictionaries as detailed at |nvim_get_option_info2()|. Return: ~ dictionary of all options @@ -1926,8 +1926,8 @@ nvim_get_option({name}) *nvim_get_option()* Return: ~ Option value (global) -nvim_get_option_info({name}) *nvim_get_option_info()* - Gets the option information for one option +nvim_get_option_info2({name}, {*opts}) *nvim_get_option_info2()* + Gets the option information for one option from arbitrary buffer or window Resulting dictionary has keys: • name: Name of the option (like 'filetype') @@ -1943,8 +1943,19 @@ nvim_get_option_info({name}) *nvim_get_option_info()* • commalist: List of comma separated values • flaglist: List of single char flags + When {scope} is not provided, the last set information applies to the + local value in the current buffer or window if it is available, otherwise + the global value information is returned. This behavior can be disabled by + explicitly specifying {scope} in the {opts} table. + Parameters: ~ • {name} Option name + • {opts} Optional parameters + • scope: One of "global" or "local". Analogous to |:setglobal| + and |:setlocal|, respectively. + • win: |window-ID|. Used for getting window local options. + • buf: Buffer number. Used for getting buffer local options. + Implies {scope} is "local". Return: ~ Option Information diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index 69cec8da53..3eb2017bed 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -20,6 +20,7 @@ API - *nvim_get_hl_by_name()* Use |nvim_get_hl()| instead. - *nvim_get_hl_by_id()* Use |nvim_get_hl()| instead. - *nvim_exec()* Use |nvim_exec2()| instead. +- *nvim_get_option_info()* Use |nvim_get_option_info2()| instead. COMMANDS - *:rv* *:rviminfo* Deprecated alias to |:rshada| command. |