mirror of
https://github.com/neovim/neovim.git
synced 2026-01-07 05:43:14 +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({}, {
|
return setmetatable({}, {
|
||||||
__index = function(_, k)
|
__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,
|
end,
|
||||||
|
|
||||||
__newindex = function(_, k, v)
|
__newindex = function(_, k, v)
|
||||||
|
|||||||
@@ -2187,6 +2187,22 @@ describe('lua stdlib', function()
|
|||||||
end)
|
end)
|
||||||
end) -- vim.opt
|
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()
|
it('vim.cmd', function()
|
||||||
exec_lua [[
|
exec_lua [[
|
||||||
vim.cmd "autocmd BufNew * ++once lua BUF = vim.fn.expand('<abuf>')"
|
vim.cmd "autocmd BufNew * ++once lua BUF = vim.fn.expand('<abuf>')"
|
||||||
|
|||||||
Reference in New Issue
Block a user