Skip to content
Myr

[vim] Simplify :FZF

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

Ruby version can also accept `--expect` option although it's ignored.

authored by Junegunn Choi · committed by Junegunn Choi · parent 51a19a2 · Browse files · 1 file+3 added−13 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−13 removed

  • other:+3 added−13 removed

1 file+3 added−13 removed

modified:plugin/fzf.vim+3 added-13 removed
24 unmodified lines
25let s:launcher = 'xterm -e bash -ic %s'26let s:fzf_go = expand('<sfile>:h:h').'/bin/fzf'27let s:fzf_rb = expand('<sfile>:h:h').'/fzf'28let s:fzf_tmux = expand('<sfile>:h:h').'/bin/fzf-tmux'29let s:legacy = 02930let s:cpo_save = &cpo31set cpo&vim32
6 unmodified lines
39 if !v:shell_error && !empty(path)40 let s:exec = path[0]41 elseif executable(s:fzf_rb)42 let s:exec = s:fzf_rb44 let s:legacy = 143 else44 call system('type fzf')45 if v:shell_error46 throw 'fzf executable not found'
276 unmodified lines
323 endfor324endfunction325326function! s:cmd(bang, ...) abort329 let args = copy(a:000)330 if !s:legacy331 let args = insert(args, '--expect=ctrl-t,ctrl-x,ctrl-v', 0)332 endif327 let args = extend(['--expect=ctrl-t,ctrl-x,ctrl-v'], a:000)328 let opts = {}329 if len(args) > 0 && isdirectory(expand(args[-1]))330 let opts.dir = remove(args, -1)331 endif332 if !a:bang333 let opts.down = get(g:, 'fzf_tmux_height', s:default_tmux_height)334 endif340341 if s:legacy342 call fzf#run(extend({ 'options': join(args), 'sink': 'e' }, opts))343 else344 call fzf#run(extend({ 'options': join(args), 'sink*': function('<sid>cmd_callback') }, opts))335 call fzf#run(extend({'options': join(args), 'sink*': function('<sid>cmd_callback')}, opts))345 endif336endfunction337348command! -nargs=* -complete=dir -bang FZF call s:cmd('<bang>' == '!', <f-args>)338command! -nargs=* -complete=dir -bang FZF call s:cmd(<bang>0, <f-args>)339340let &cpo = s:cpo_save341unlet s:cpo_save342