commit 18071f599955f6720170d9daa6835a663a6bbaf0
parent e653a682705234e9bffac0c32995f339e66df684
Author: Phil Runninger (mac) <prunninger@vhtcx.com>
Date: Wed, 22 Aug 2018 17:01:08 -0400
NERDTreeCWD: reset CWD if changed by NERDTreeFocus
When the user has `'autochdir'` turned on, opening a new NERDTree will
cause the current working directory to change. To prevent this
happening, remember the CWD and reset it if NERDTreeFocus caused it to
change.
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -202,7 +202,11 @@ function! NERDTreeFocus()
endfunction
function! NERDTreeCWD()
+ let l:cwd = getcwd()
call NERDTreeFocus()
+ if l:cwd != getcwd()
+ exec 'cd '.l:cwd
+ endif
call nerdtree#ui_glue#chRootCwd()
endfunction