From b1127c5deaca10e570ffbb33b4045b775971aaeb Mon Sep 17 00:00:00 2001 From: kiyan Date: Mon, 14 Feb 2022 19:51:40 +0100 Subject: [PATCH] fix: auto open on tab it was scheduled before because of the weird management of events, but now as it's been fixed in the latest big PR, this works just fine without scheduling. Needs a redraw because the buffer is recreated. --- lua/nvim-tree.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index 66e3a08a..c95902d2 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -39,15 +39,14 @@ function M.open(cwd) end function M.tab_change() - vim.schedule(function() - if not view.is_visible() and view.is_visible({ any_tabpage = true }) then - local bufname = vim.api.nvim_buf_get_name(0) - if bufname:match("Neogit") ~= nil or bufname:match("--graph") ~= nil then - return - end - view.open({ focus_tree = false }) + if view.is_visible({ any_tabpage = true }) then + local bufname = vim.api.nvim_buf_get_name(0) + if bufname:match("Neogit") ~= nil or bufname:match("--graph") ~= nil then + return end - end) + view.open({ focus_tree = false }) + require"nvim-tree.renderer".draw() + end end local function find_existing_windows()