aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_options.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/_options.lua')
-rw-r--r--runtime/lua/vim/_options.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/lua/vim/_options.lua b/runtime/lua/vim/_options.lua
index 7b44f6b35f..6a3413b597 100644
--- a/runtime/lua/vim/_options.lua
+++ b/runtime/lua/vim/_options.lua
@@ -727,7 +727,10 @@ local function create_option_accessor(scope)
return setmetatable({}, {
__index = function(_, k)
- return make_option(k, api.nvim_get_option_value(k, {}))
+ -- vim.opt_global must get global value only
+ -- vim.opt_local may fall back to global value like vim.opt
+ local opts = { scope = scope == 'global' and 'global' or nil }
+ return make_option(k, api.nvim_get_option_value(k, opts))
end,
__newindex = function(_, k, v)