From b5abc3b3ae2ebf1a89984a0a4bf69cc7ff1fe9ff Mon Sep 17 00:00:00 2001 From: Danila Usachev Date: Sun, 30 Jul 2023 16:35:19 +0300 Subject: [PATCH] fix(#2343): tree is now correctly abandoned upon an in-place open with eject=false --- lua/nvim-tree.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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, })