aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2022-06-20 17:28:37 -0600
committerGitHub <noreply@github.com>2022-06-20 17:28:37 -0600
commit6d52a29c3b8714804facdc7705e57e7f0511c85a (patch)
tree9946fd24985607c430494cf2318415312e327a7c /runtime
parentbc6a5943dec0fddbc8523a33506ed933f71584ba (diff)
parent87a68b6a3ab483c6b126fa8071066a112f9386a3 (diff)
downloadrneovim-6d52a29c3b8714804facdc7705e57e7f0511c85a.tar.gz
rneovim-6d52a29c3b8714804facdc7705e57e7f0511c85a.tar.bz2
rneovim-6d52a29c3b8714804facdc7705e57e7f0511c85a.zip
Merge pull request #18743 from gpanders/bowooptvalue
Add "buf" and "win" to nvim_get_option_value and use them in vim.bo and vim.wo
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/api.txt10
-rw-r--r--runtime/lua/vim/_meta.lua8
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)