mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-23 03:19:01 +00:00
[vim] Fix issues with other plugins changing working directory
Close #1005
This commit is contained in:
parent
999d374f0c
commit
462c68b625
@ -466,11 +466,11 @@ augroup fzf_popd
|
||||
augroup END
|
||||
|
||||
function! s:dopopd()
|
||||
if !exists('w:fzf_prev_dir') || exists('*haslocaldir') && !haslocaldir()
|
||||
if !exists('w:fzf_dir') || s:fzf_getcwd() != w:fzf_dir[1]
|
||||
return
|
||||
endif
|
||||
execute 'lcd' s:escape(w:fzf_prev_dir)
|
||||
unlet w:fzf_prev_dir
|
||||
execute 'lcd' s:escape(w:fzf_dir[0])
|
||||
unlet w:fzf_dir
|
||||
endfunction
|
||||
|
||||
function! s:xterm_launcher()
|
||||
@ -719,7 +719,7 @@ function! s:callback(dict, lines) abort
|
||||
let popd = has_key(a:dict, 'prev_dir') &&
|
||||
\ (!&autochdir || (empty(a:lines) || len(a:lines) == 1 && empty(a:lines[0])))
|
||||
if popd
|
||||
let w:fzf_prev_dir = a:dict.prev_dir
|
||||
let w:fzf_dir = [a:dict.prev_dir, a:dict.dir]
|
||||
endif
|
||||
|
||||
try
|
||||
@ -743,7 +743,7 @@ function! s:callback(dict, lines) abort
|
||||
|
||||
" We may have opened a new window or tab
|
||||
if popd
|
||||
let w:fzf_prev_dir = a:dict.prev_dir
|
||||
let w:fzf_dir = [a:dict.prev_dir, a:dict.dir]
|
||||
call s:dopopd()
|
||||
endif
|
||||
endfunction
|
||||
|
Loading…
Reference in New Issue
Block a user