mirror of
https://github.com/junegunn/fzf.git
synced 2025-05-19 12:50:22 -07: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
|
augroup END
|
||||||
|
|
||||||
function! s:dopopd()
|
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
|
return
|
||||||
endif
|
endif
|
||||||
execute 'lcd' s:escape(w:fzf_prev_dir)
|
execute 'lcd' s:escape(w:fzf_dir[0])
|
||||||
unlet w:fzf_prev_dir
|
unlet w:fzf_dir
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:xterm_launcher()
|
function! s:xterm_launcher()
|
||||||
@ -719,7 +719,7 @@ function! s:callback(dict, lines) abort
|
|||||||
let popd = has_key(a:dict, 'prev_dir') &&
|
let popd = has_key(a:dict, 'prev_dir') &&
|
||||||
\ (!&autochdir || (empty(a:lines) || len(a:lines) == 1 && empty(a:lines[0])))
|
\ (!&autochdir || (empty(a:lines) || len(a:lines) == 1 && empty(a:lines[0])))
|
||||||
if popd
|
if popd
|
||||||
let w:fzf_prev_dir = a:dict.prev_dir
|
let w:fzf_dir = [a:dict.prev_dir, a:dict.dir]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -743,7 +743,7 @@ function! s:callback(dict, lines) abort
|
|||||||
|
|
||||||
" We may have opened a new window or tab
|
" We may have opened a new window or tab
|
||||||
if popd
|
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()
|
call s:dopopd()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user