Added new option, respect_buf_cwd (#533)

This commit is contained in:
Yusuke Uchida
2021-08-07 16:59:42 +09:00
committed by GitHub
parent 7bed04718e
commit 143505b281
3 changed files with 10 additions and 2 deletions

View File

@@ -466,8 +466,10 @@ function M.open()
view.open()
if M.Tree.loaded then
M.change_dir(vim.fn.getcwd())
local cwd = vim.fn.getcwd()
local respect_buf_cwd = vim.g.nvim_tree_respect_buf_cwd or 0
if M.Tree.loaded or (respect_buf_cwd == 1 and cwd ~= M.Tree.cwd) then
M.change_dir(cwd)
end
renderer.draw(M.Tree, not M.Tree.loaded)
M.Tree.loaded = true