Skip to content

Commit 4a40050

Browse files
committed
Moved option check inside the callback
1 parent 351a3e9 commit 4a40050

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

lua/nvim-tree.lua

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,15 @@ local function setup_autocommands(opts)
192192
-- reset highlights when colorscheme is changed
193193
create_nvim_tree_autocmd("ColorScheme", { callback = M.reset_highlight })
194194

195-
if opts.actions.open_file.prevent_buffer_override then
196-
-- prevent new opened file from opening in the same window as nvim-tree
197-
create_nvim_tree_autocmd("BufWipeout", {
198-
pattern = "NvimTree_*",
199-
callback = function()
200-
if utils.is_nvim_tree_buf(0) then
201-
view._prevent_buffer_override()
202-
end
203-
end,
204-
})
205-
end
195+
-- prevent new opened file from opening in the same window as nvim-tree
196+
create_nvim_tree_autocmd("BufWipeout", {
197+
pattern = "NvimTree_*",
198+
callback = function()
199+
if utils.is_nvim_tree_buf(0) and opts.actions.open_file.prevent_buffer_override then
200+
view._prevent_buffer_override()
201+
end
202+
end,
203+
})
206204

207205
create_nvim_tree_autocmd("BufWritePost", {
208206
callback = function()

0 commit comments

Comments
 (0)