fix: hide the base dir update on bufenter behind an option
This commit is contained in:
parent
5bca2006cc
commit
d41ca62320
@ -37,6 +37,8 @@ let g:nvim_tree_auto_close = 1 "0 by default, closes the tree when it's the last
|
|||||||
let g:nvim_tree_auto_ignore_ft = [ 'startify', 'dashboard' ] "empty by default, don't auto open tree on specific filetypes.
|
let g:nvim_tree_auto_ignore_ft = [ 'startify', 'dashboard' ] "empty by default, don't auto open tree on specific filetypes.
|
||||||
let g:nvim_tree_quit_on_open = 1 "0 by default, closes the tree when you open a file
|
let g:nvim_tree_quit_on_open = 1 "0 by default, closes the tree when you open a file
|
||||||
let g:nvim_tree_follow = 1 "0 by default, this option allows the cursor to be updated when entering a buffer
|
let g:nvim_tree_follow = 1 "0 by default, this option allows the cursor to be updated when entering a buffer
|
||||||
|
let g:nvim_tree_follow_update_path = 1 "0 by default, will update the path of the current dir if the file is not inside the tree.
|
||||||
|
Default is 0
|
||||||
let g:nvim_tree_indent_markers = 1 "0 by default, this option shows indent markers when folders are open
|
let g:nvim_tree_indent_markers = 1 "0 by default, this option shows indent markers when folders are open
|
||||||
let g:nvim_tree_hide_dotfiles = 1 "0 by default, this option hides files and folders starting with a dot `.`
|
let g:nvim_tree_hide_dotfiles = 1 "0 by default, this option hides files and folders starting with a dot `.`
|
||||||
let g:nvim_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons).
|
let g:nvim_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons).
|
||||||
|
|||||||
@ -172,6 +172,12 @@ Can be `0` or `1`. When `1`, will update the cursor to update to the correct
|
|||||||
location in the tree on |BufEnter|.
|
location in the tree on |BufEnter|.
|
||||||
Default is 0
|
Default is 0
|
||||||
|
|
||||||
|
|g:nvim_tree_follow_update_path| *g:nvim_tree_follow_update_path*
|
||||||
|
|
||||||
|
Can be `0` or `1`. When `1`, will update the path of the current dir if the
|
||||||
|
file is not inside the tree. Works only with |g:nvim_tree_follow| = 1.
|
||||||
|
Default is 0
|
||||||
|
|
||||||
|g:nvim_tree_auto_open| *g:nvim_tree_auto_open*
|
|g:nvim_tree_auto_open| *g:nvim_tree_auto_open*
|
||||||
|
|
||||||
Can be `0` or `1`. When `1`, will open the tree when the package is loaded.
|
Can be `0` or `1`. When `1`, will open the tree when the package is loaded.
|
||||||
|
|||||||
@ -223,6 +223,9 @@ local function is_file_readable(fname)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function update_base_dir_with_filepath(filepath)
|
local function update_base_dir_with_filepath(filepath)
|
||||||
|
if vim.g.nvim_tree_follow_update_path ~= 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
if not vim.startswith(filepath, lib.Tree.cwd or vim.loop.cwd()) then
|
if not vim.startswith(filepath, lib.Tree.cwd or vim.loop.cwd()) then
|
||||||
lib.change_dir(vim.fn.fnamemodify(filepath, ':p:h'))
|
lib.change_dir(vim.fn.fnamemodify(filepath, ':p:h'))
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user