mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-12 05:13:50 -05:00
Support tab-specific CWDs (#1032)
* Change CWD when switching tabs to the tab's NERDTree root. * Remove commented-out code. * List the new possible value for NERDTreeChDirMode in doc. * Add new option to select between `:cd` and `:tcd`. * Document the new NERDTreeUseTCD option. * Update version number in change log.
This commit is contained in:
@@ -20,7 +20,7 @@ function! s:NERDTree.changeRoot(node)
|
||||
call self.root.open()
|
||||
|
||||
"change dir to the dir of the new root if instructed to
|
||||
if g:NERDTreeChDirMode ==# 2
|
||||
if g:NERDTreeChDirMode >= 2
|
||||
call self.root.path.changeToDir()
|
||||
endif
|
||||
|
||||
|
||||
@@ -87,8 +87,13 @@ function! s:Path.changeToDir()
|
||||
endif
|
||||
|
||||
try
|
||||
execute "cd " . dir
|
||||
call nerdtree#echo("CWD is now: " . getcwd())
|
||||
if g:NERDTreeUseTCD && exists(":tcd") == 2
|
||||
execute "tcd " . dir
|
||||
call nerdtree#echo("Tab's CWD is now: " . getcwd())
|
||||
else
|
||||
execute "cd " . dir
|
||||
call nerdtree#echo("CWD is now: " . getcwd())
|
||||
endif
|
||||
catch
|
||||
throw "NERDTree.PathChangeError: cannot change CWD to " . dir
|
||||
endtry
|
||||
|
||||
Reference in New Issue
Block a user