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.
This commit is contained in:
Phil Runninger (mac) 2018-08-22 17:01:08 -04:00
parent e653a68270
commit 18071f5999

View File

@ -202,7 +202,11 @@ function! NERDTreeFocus()
endfunction endfunction
function! NERDTreeCWD() function! NERDTreeCWD()
let l:cwd = getcwd()
call NERDTreeFocus() call NERDTreeFocus()
if l:cwd != getcwd()
exec 'cd '.l:cwd
endif
call nerdtree#ui_glue#chRootCwd() call nerdtree#ui_glue#chRootCwd()
endfunction endfunction