fix: use defer_fn to close the tree properly

This commit is contained in:
kyazdani42 2020-06-04 23:29:10 +02:00
parent 3997c53df6
commit f6b38bb364

View File

@ -90,12 +90,11 @@ local function find_file()
end
function M.on_leave()
if #api.nvim_list_wins() == 2
and tree.win_open()
and api.nvim_get_current_buf() ~= tree.Tree.bufnr
then
api.nvim_command(':qa!')
end
vim.defer_fn(function()
if #api.nvim_list_wins() == 1 and tree.win_open() then
api.nvim_command(':qa!')
end
end, 50)
end
local function update_root_dir()