Added new option, respect_buf_cwd (#533)
This commit is contained in:
parent
7bed04718e
commit
143505b281
@ -54,6 +54,7 @@ let g:nvim_tree_hijack_cursor = 0 "1 by default, when moving cursor in the tree,
|
||||
let g:nvim_tree_icon_padding = ' ' "one space by default, used for rendering the space between the icon and the filename. Use with caution, it could break rendering if you set an empty string depending on your font.
|
||||
let g:nvim_tree_symlink_arrow = ' >> ' " defaults to ' ➛ '. used as a separator between symlinks' source and target.
|
||||
let g:nvim_tree_update_cwd = 1 "0 by default, will update the tree cwd when changing nvim's directory (DirChanged event). Behaves strangely with autochdir set.
|
||||
let g:nvim_tree_respect_buf_cwd = 1 "0 by default, will change cwd of nvim-tree to that of new buffer's when opening nvim-tree.
|
||||
let g:nvim_tree_window_picker_exclude = {
|
||||
\ 'filetype': [
|
||||
\ 'packer',
|
||||
|
||||
@ -320,6 +320,11 @@ Can be 0 or 1. 0 by default.
|
||||
Will update the tree cwd when changing nvim's directory (DirChanged event).
|
||||
WARNING: Behaves strangely with autochdir set.
|
||||
|
||||
|g:nvim_tree_respect_buf_cwd| *g:nvim_tree_respect_buf_cwd*
|
||||
|
||||
Can be 0 or 1. 0 by default.
|
||||
Will change cwd of nvim-tree to that of new buffer's when opening nvim-tree.
|
||||
|
||||
==============================================================================
|
||||
INFORMATIONS *nvim-tree-info*
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user