refacto: remove rendering from lib.init

This commit is contained in:
kiyan
2022-02-20 23:01:25 +01:00
parent 9008bac180
commit 58b81ed9e6
3 changed files with 11 additions and 9 deletions

View File

@@ -14,13 +14,10 @@ local M = {
TreeExplorer = nil
function M.init(with_open, foldername)
function M.init(foldername)
local init_done = false
TreeExplorer = explorer.Explorer.new(foldername)
TreeExplorer:init(function()
if with_open then
M.open()
end
init_done = true
if not first_init_done then
events._dispatch_ready()
@@ -138,7 +135,7 @@ end
function M.open(cwd)
M.set_target_win()
if not TreeExplorer or cwd then
return M.init(true, cwd or vim.loop.cwd())
M.init(cwd or vim.loop.cwd())
end
if should_hijack_current_buf() then
view.open_in_current_win()