Skip to content
Myr

[vim] Do not restore cwd when autochdir is set and buffer changed

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Close #1539

authored by Junegunn Choi · committed by Junegunn Choi · parent a0bfbdd · Browse files · 1 file+3 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−2 removed

  • other:+3 added−2 removed

1 file+3 added−2 removed

modified:plugin/fzf.vim+3 added-2 removed
455 unmodified lines
456 if s:present(a:dict, 'dir')457 let cwd = s:fzf_getcwd()458 let w:fzf_pushd = {459 \ 'command': haslocaldir() ? 'lcd' : (exists(':tcd') && haslocaldir(-1) ? 'tcd' : 'cd'),460 \ 'origin': cwd460 \ 'origin': cwd,461 \ 'bufname': bufname('')462 \ }463 execute 'lcd' s:escape(a:dict.dir)464 let cwd = s:fzf_getcwd()465 let w:fzf_pushd.dir = cwd
27 unmodified lines
493 " here is that we change directory only if the current working directory494 " matches 'dir' entry. However, it is possible that the sink function did495 " change the directory to 'dir'. In that case, the user will have an496 " unexpected result.496 if s:fzf_getcwd() ==# w:fzf_pushd.dir497 if s:fzf_getcwd() ==# w:fzf_pushd.dir && (!&autochdir || w:fzf_pushd.bufname ==# bufname(''))498 execute w:fzf_pushd.command s:escape(w:fzf_pushd.origin)499 endif500 unlet w:fzf_pushd501endfunction
312 unmodified lines