From 83f398ee8f343533e2269874dd286f1b2a319d87 Mon Sep 17 00:00:00 2001 From: kiyan Date: Sun, 20 Feb 2022 21:48:46 +0100 Subject: [PATCH] fix: opening tree opening the tree checks bufname is directory properly and do not render before initializing when tree is nil. --- lua/nvim-tree/lib.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/nvim-tree/lib.lua b/lua/nvim-tree/lib.lua index 6549a7bd..449be767 100644 --- a/lua/nvim-tree/lib.lua +++ b/lua/nvim-tree/lib.lua @@ -126,7 +126,7 @@ local function should_hijack_current_buf() and not bufmodified and ft == "" local should_hijack_dir = bufname ~= "" - and vim.fn.isdirectory(bufname) + and vim.fn.isdirectory(bufname) == 1 and M.hijack_directories.enable return should_hijack_dir or should_hijack_unnamed @@ -135,7 +135,7 @@ end function M.open(cwd) M.set_target_win() if not TreeExplorer or cwd then - M.init(false, cwd or vim.loop.cwd()) + return M.init(true, cwd or vim.loop.cwd()) end if should_hijack_current_buf() then view.open_in_current_win()