[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.
pull/443/merge
Junegunn Choi 9 years ago
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…
Cancel
Save