fix(lua): not using global value in vim.opt_global

This commit is contained in:
Phelipe Teles
2023-09-16 19:35:12 -03:00
committed by zeertzjq
parent 68ae7ea529
commit 3a5b46e6bb
2 changed files with 19 additions and 3 deletions

View File

@@ -526,7 +526,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)