From b18db4733c635705b3aa052efe91472432727c58 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 11 Jan 2016 18:17:13 +0900 Subject: [PATCH] [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. --- plugin/fzf.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 89f1b21..8dc5b8a 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -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