Skip to content

Commit bb23127

Browse files
committed
chore: resolve undefined-field
1 parent d631ee1 commit bb23127

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

lua/nvim-tree/view.lua

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,30 @@ end
147147

148148
local function set_window_options_and_buffer()
149149
pcall(vim.api.nvim_command, "buffer " .. M.get_bufnr())
150-
local eventignore = vim.opt.eventignore:get()
151-
vim.opt.eventignore = "all"
152-
for k, v in pairs(M.View.winopts) do
153-
vim.opt_local[k] = v
150+
151+
if vim.fn.has("nvim-0.10") == 1 then
152+
153+
local eventignore = vim.api.nvim_get_option_value("eventignore", {})
154+
vim.api.nvim_set_option_value("eventignore", "all", {})
155+
156+
for k, v in pairs(M.View.winopts) do
157+
vim.api.nvim_set_option_value(k, v, { scope = "local" })
158+
end
159+
160+
vim.api.nvim_set_option_value("eventignore", eventignore, {})
161+
162+
else
163+
164+
local eventignore = vim.api.nvim_get_option("eventignore") ---@diagnostic disable-line: deprecated
165+
vim.api.nvim_set_option("eventignore", "all") ---@diagnostic disable-line: deprecated
166+
167+
for k, v in pairs(M.View.winopts) do
168+
vim.api.nvim_win_set_option(0, k, v) ---@diagnostic disable-line: deprecated
169+
end
170+
171+
vim.api.nvim_set_option("eventignore", eventignore) ---@diagnostic disable-line: deprecated
172+
154173
end
155-
vim.opt.eventignore = eventignore
156174
end
157175

158176
---@return table

0 commit comments

Comments
 (0)