Skip to content

Commit b1127c5

Browse files
committed
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.
1 parent ad2802d commit b1127c5

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lua/nvim-tree.lua

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,14 @@ function M.open(cwd)
3939
end
4040

4141
function M.tab_change()
42-
vim.schedule(function()
43-
if not view.is_visible() and view.is_visible({ any_tabpage = true }) then
44-
local bufname = vim.api.nvim_buf_get_name(0)
45-
if bufname:match("Neogit") ~= nil or bufname:match("--graph") ~= nil then
46-
return
47-
end
48-
view.open({ focus_tree = false })
42+
if view.is_visible({ any_tabpage = true }) then
43+
local bufname = vim.api.nvim_buf_get_name(0)
44+
if bufname:match("Neogit") ~= nil or bufname:match("--graph") ~= nil then
45+
return
4946
end
50-
end)
47+
view.open({ focus_tree = false })
48+
require"nvim-tree.renderer".draw()
49+
end
5150
end
5251

5352
local function find_existing_windows()

0 commit comments

Comments
 (0)