mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
fix: vim.opt_local:append ignoring global option value (#21382)
Closes https://github.com/neovim/neovim/issues/18225
This commit is contained in:
@@ -526,7 +526,7 @@ local function create_option_accessor(scope)
|
||||
|
||||
return setmetatable({}, {
|
||||
__index = function(_, k)
|
||||
return make_option(k, a.nvim_get_option_value(k, { scope = scope }))
|
||||
return make_option(k, a.nvim_get_option_value(k, {}))
|
||||
end,
|
||||
|
||||
__newindex = function(_, k, v)
|
||||
|
@@ -2187,6 +2187,22 @@ describe('lua stdlib', function()
|
||||
end)
|
||||
end) -- vim.opt
|
||||
|
||||
describe('opt_local', function()
|
||||
it('should be able to append to an array list type option', function()
|
||||
eq({ "foo,bar,baz,qux" }, exec_lua [[
|
||||
local result = {}
|
||||
|
||||
vim.opt.tags = "foo,bar"
|
||||
vim.opt_local.tags:append("baz")
|
||||
vim.opt_local.tags:append("qux")
|
||||
|
||||
table.insert(result, vim.bo.tags)
|
||||
|
||||
return result
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
it('vim.cmd', function()
|
||||
exec_lua [[
|
||||
vim.cmd "autocmd BufNew * ++once lua BUF = vim.fn.expand('<abuf>')"
|
||||
|
Reference in New Issue
Block a user