[vim] Do not restore working directory on unexpected cwd
We should not restore the previous working directory if the current directory has changed somehow. This can happen when &autochdir is set.
This commit is contained in:
parent
6e08fe337c
commit
b18db4733c
@ -201,7 +201,7 @@ function! s:pushd(dict)
|
||||
endfunction
|
||||
|
||||
function! s:popd(dict)
|
||||
if has_key(a:dict, 'prev_dir')
|
||||
if has_key(a:dict, 'prev_dir') && getcwd() ==# a:dict.dir
|
||||
execute 'chdir '.s:escape(remove(a:dict, 'prev_dir'))
|
||||
endif
|
||||
endfunction
|
||||
|
Loading…
Reference in New Issue
Block a user