diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/api.txt | 10 | ||||
-rw-r--r-- | runtime/lua/vim/_meta.lua | 8 |
2 files changed, 10 insertions, 8 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 331a4fe700..1d7a783bf1 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -2037,15 +2037,17 @@ nvim_get_option_value({name}, {*opts}) *nvim_get_option_value()* matches that of |:set|: the local value of an option is returned if it exists; otherwise, the global value is returned. Local values always correspond to the current buffer - or window. To get a buffer-local or window-local option for a - specific buffer or window, use |nvim_buf_get_option()| or - |nvim_win_get_option()|. + or window, unless "buf" or "win" is set in {opts}. Parameters: ~ {name} Option name {opts} Optional parameters - • scope: One of 'global' or 'local'. Analogous to + • 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 value diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index 59cf837a1d..715a7e5561 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -91,11 +91,11 @@ do -- buffer option accessor return new_buf_opt_accessor(k) end - return a.nvim_buf_get_option(bufnr or 0, k) + return a.nvim_get_option_value(k, { buf = bufnr or 0 }) end local function set(k, v) - return a.nvim_buf_set_option(bufnr or 0, k, v) + return a.nvim_set_option_value(k, v, { buf = bufnr or 0 }) end return make_meta_accessor(get, set, nil, function(k) @@ -121,11 +121,11 @@ do -- window option accessor if winnr == nil and type(k) == 'number' then return new_win_opt_accessor(k) end - return a.nvim_win_get_option(winnr or 0, k) + return a.nvim_get_option_value(k, { win = winnr or 0 }) end local function set(k, v) - return a.nvim_win_set_option(winnr or 0, k, v) + return a.nvim_set_option_value(k, v, { win = winnr or 0 }) end return make_meta_accessor(get, set, nil, function(k) |