Closed kawre closed 10 months ago
On Neovim version 0.10 the code i provided crashes. It has to be split into buf and win options
function utils.set_buf_opts(bufnr, options)
if not bufnr then return end
log.debug("applying `opt_local` to bufnr: " .. bufnr)
for key, value in pairs(options) do
pcall(vim.api.nvim_set_option_value, key, value, { buf = bufnr })
end
end
function utils.set_win_opts(winid, options)
if not winid then return end
log.debug("applying `opt_local` to winid: " .. winid)
for key, value in pairs(options) do
pcall(vim.api.nvim_set_option_value, key, value, { win = winid, scope = "local" })
end
end
nui.nvim
should now be using the new api on Neovim v0.10+
I'm facing an issue where, when I open a new file using
:edit
from within a nui component, the window options from that component are carried over.The fix i found is to use
nvim_set_option_value
withopts = { win = winid, scope = "local" }
https://github.com/MunifTanjim/nui.nvim/assets/69250723/c902ee4c-6d0b-494a-9d78-e98e22be125a