[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:
Junegunn Choi 2016-01-11 18:17:13 +09:00
parent 6e08fe337c
commit b18db4733c

View File

@ -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