From 8a4db3c0041c35ca195468c779d42829d7dabe59 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 29 Mar 2015 11:14:16 +0900 Subject: [PATCH] [vim] Fix #167 - :FZF with directory --- plugin/fzf.vim | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 9c8ae62..94df15f 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -241,7 +241,7 @@ endfunction function! s:cmd(bang, ...) abort let args = copy(a:000) if !s:legacy - let args = add(args, '--expect=ctrl-t,ctrl-x,ctrl-v') + let args = insert(args, '--expect=ctrl-t,ctrl-x,ctrl-v', 0) endif let opts = {} if len(args) > 0 && isdirectory(expand(args[-1])) @@ -264,9 +264,14 @@ function! s:cmd(bang, ...) abort elseif key == 'ctrl-v' | let cmd = 'vsplit' else | let cmd = 'e' endif - for item in output - execute cmd s:escape(item) - endfor + try + call s:pushd(opts) + for item in output + execute cmd s:escape(item) + endfor + finally + call s:popd(opts) + endtry endif endfunction