@ -23,23 +23,25 @@
let s :exec = expand ( '<sfile>:h:h' ) .'/fzf'
let s :exec = expand ( '<sfile>:h:h' ) .'/fzf'
function ! s: fzf( args )
function ! fzf#run ( command , args )
try
try
let tf = tempname ( )
let tf = tempname ( )
let prefix = exists ( 'g:fzf_command' ) ? g :fzf_command .'|' : ''
let prefix = exists ( 'g:fzf_source' ) ? g :fzf_source .'|' : ''
let fzf = executable ( s :exec ) ? s :exec : 'fzf'
let fzf = executable ( s :exec ) ? s :exec : 'fzf'
execute "silent !" .prefix .fzf ." " .a :args ." > " .tf
let options = empty ( a :args ) ? get ( g :, 'fzf_options' , '' ) : a :args
execute "silent !" .prefix .fzf .' ' .options ." > " .tf
if ! v :shell_error
if ! v :shell_error
let file = join ( readfile ( tf ) , '' )
for line in readfile ( tf )
if ! empty ( file )
if ! empty ( line )
execute 'silent e ' .file
execute a :command .' ' .line
endif
endif
endfor
endif
endif
finally
finally
silent ! call delete ( tf )
redraw !
redraw !
silent ! call delete ( tf )
endtry
endtry
endfunction
endfunction
command ! - nargs = * FZF call s: fzf( < q - args > )
command ! - nargs = * FZF call fzf#run ( 'silent e' , < q - args > )