diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index d1b7a01b49e..d07a4870a5e 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -196,8 +196,13 @@ local function setup_autocommands(opts) create_nvim_tree_autocmd("BufWipeout", { pattern = "NvimTree_*", callback = function() - if utils.is_nvim_tree_buf(0) and opts.actions.open_file.eject then + if not utils.is_nvim_tree_buf(0) then + return + end + if opts.actions.open_file.eject then view._prevent_buffer_override() + else + view.abandon_current_window() end end, })