[vim] Fix #167 - :FZF with directory

This commit is contained in:
Junegunn Choi 2015-03-29 11:14:16 +09:00
parent cef93f700b
commit 8a4db3c004

View File

@ -241,7 +241,7 @@ endfunction
function! s:cmd(bang, ...) abort function! s:cmd(bang, ...) abort
let args = copy(a:000) let args = copy(a:000)
if !s:legacy 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 endif
let opts = {} let opts = {}
if len(args) > 0 && isdirectory(expand(args[-1])) if len(args) > 0 && isdirectory(expand(args[-1]))
@ -264,9 +264,14 @@ function! s:cmd(bang, ...) abort
elseif key == 'ctrl-v' | let cmd = 'vsplit' elseif key == 'ctrl-v' | let cmd = 'vsplit'
else | let cmd = 'e' else | let cmd = 'e'
endif endif
try
call s:pushd(opts)
for item in output for item in output
execute cmd s:escape(item) execute cmd s:escape(item)
endfor endfor
finally
call s:popd(opts)
endtry
endif endif
endfunction endfunction