Skip to content

Commit 9d6f4c1

Browse files
committed
chore: remove custom set local implementation
Seems vim.opt_local has been fixed. see neovim/neovim#14670
1 parent 17d5bd6 commit 9d6f4c1

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

lua/nvim-tree/view.lua

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -108,38 +108,26 @@ local move_tbl = {
108108
top = "K",
109109
}
110110

111-
-- TODO: remove this once they fix https://github.com/neovim/neovim/issues/14670
112-
local function set_local(opt, value)
113-
local cmd
114-
if value == true then
115-
cmd = string.format("setlocal %s", opt)
116-
elseif value == false then
117-
cmd = string.format("setlocal no%s", opt)
118-
else
119-
cmd = string.format("setlocal %s=%s", opt, value)
120-
end
121-
vim.cmd(cmd)
122-
end
123-
124111
-- setup_tabpage sets up the initial state of a tab
125112
local function setup_tabpage(tabpage)
126113
local winnr = a.nvim_get_current_win()
127114
M.View.tabpages[tabpage] = vim.tbl_extend("force", M.View.tabpages[tabpage] or tabinitial, { winnr = winnr })
128115
end
129116

130-
local function open_window()
131-
a.nvim_command "vsp"
132-
M.reposition_window()
133-
setup_tabpage(a.nvim_get_current_tabpage())
134-
end
135-
136117
local function set_window_options_and_buffer()
137118
pcall(vim.cmd, "buffer " .. M.get_bufnr())
138119
for k, v in pairs(M.View.winopts) do
139-
set_local(k, v)
120+
vim.opt_local[k] = v
140121
end
141122
end
142123

124+
local function open_window()
125+
a.nvim_command "vsp"
126+
M.reposition_window()
127+
setup_tabpage(a.nvim_get_current_tabpage())
128+
set_window_options_and_buffer()
129+
end
130+
143131
local function get_existing_buffers()
144132
return vim.tbl_filter(function(buf)
145133
return a.nvim_buf_is_valid(buf) and vim.fn.buflisted(buf) == 1
@@ -190,7 +178,6 @@ function M.open(options)
190178

191179
create_buffer()
192180
open_window()
193-
set_window_options_and_buffer()
194181
M.resize()
195182

196183
local opts = options or { focus_tree = true }

0 commit comments

Comments
 (0)