Skip to content

Commit 4231abe

Browse files
committed
fix: change order of bufenter event code to ensure window are options are set
1 parent a4633c3 commit 4231abe

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

lua/neo-tree.lua

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,6 @@ M.paste_default_config = function()
215215
end
216216

217217
M.buffer_enter_event = function(args)
218-
if utils.is_floating() then
219-
return
220-
end
221-
-- if vim is trying to open a dir, then we hijack it
222-
if M.hijack_netrw() then
223-
return
224-
end
225218
-- if it is a neo-tree window, just set local options
226219
if vim.bo.filetype == "neo-tree" then
227220
vim.cmd([[
@@ -240,6 +233,16 @@ M.buffer_enter_event = function(args)
240233
return
241234
end
242235

236+
-- there is nothing more we want to do with floating windows
237+
if utils.is_floating() then
238+
return
239+
end
240+
241+
-- if vim is trying to open a dir, then we hijack it
242+
if M.hijack_netrw() then
243+
return
244+
end
245+
243246
-- For all others, make sure another buffer is not hijacking our window
244247
local prior_buf = vim.fn.bufnr("#")
245248
if prior_buf < 1 then

lua/neo-tree/sources/filesystem/init.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ local follow_internal = function(callback, force_show)
111111
end
112112

113113
M.follow = function(callback, force_show)
114+
if vim.fn.bufname(0) == "COMMIT_EDITMSG" then
115+
return false
116+
end
114117
utils.debounce("neo-tree-follow", function()
115118
return follow_internal(callback, force_show)
116119
end, 200, utils.debounce_strategy.CALL_LAST_ONLY)

0 commit comments

Comments
 (0)