File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,6 +39,14 @@ M.hijack = function()
3939 utils .debounce (" hijack_netrw_" .. dir_window , function ()
4040 local manager = require (" neo-tree.sources.manager" )
4141 local log = require (" neo-tree.log" )
42+ -- The hijack may have been triggered by a BufEnter that fired in a transient
43+ -- window that no longer exists (this can happen during `:e <dir>` when the
44+ -- startup buffer is a directory). Skip in that case so we don't create an
45+ -- orphan state for a dead window.
46+ if not vim .api .nvim_win_is_valid (dir_window ) then
47+ log .debug (" hijack_netrw: dir_window" , dir_window , " is no longer valid, skipping" )
48+ return
49+ end
4250 -- We will want to replace the "directory" buffer with either the "alternate"
4351 -- buffer or a new blank one.
4452 local replacement_buffer = vim .fn .bufnr (" #" )
You can’t perform that action at this time.
0 commit comments