mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user