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.
This commit is contained in:
kiyan
2022-02-14 19:51:40 +01:00
parent ad2802d9c4
commit b1127c5dea

View File

@@ -39,15 +39,14 @@ function M.open(cwd)
end end
function M.tab_change() function M.tab_change()
vim.schedule(function() if view.is_visible({ any_tabpage = true }) then
if not view.is_visible() and view.is_visible({ any_tabpage = true }) then local bufname = vim.api.nvim_buf_get_name(0)
local bufname = vim.api.nvim_buf_get_name(0) if bufname:match("Neogit") ~= nil or bufname:match("--graph") ~= nil then
if bufname:match("Neogit") ~= nil or bufname:match("--graph") ~= nil then return
return
end
view.open({ focus_tree = false })
end end
end) view.open({ focus_tree = false })
require"nvim-tree.renderer".draw()
end
end end
local function find_existing_windows() local function find_existing_windows()