mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-29 00:06:29 +00:00
[vim] Simplify :FZF
Ruby version can also accept `--expect` option although it's ignored.
This commit is contained in:
parent
51a19a2804
commit
319d6ced80
@ -26,7 +26,6 @@ let s:launcher = 'xterm -e bash -ic %s'
|
||||
let s:fzf_go = expand('<sfile>:h:h').'/bin/fzf'
|
||||
let s:fzf_rb = expand('<sfile>:h:h').'/fzf'
|
||||
let s:fzf_tmux = expand('<sfile>:h:h').'/bin/fzf-tmux'
|
||||
let s:legacy = 0
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
@ -41,7 +40,6 @@ function! s:fzf_exec()
|
||||
let s:exec = path[0]
|
||||
elseif executable(s:fzf_rb)
|
||||
let s:exec = s:fzf_rb
|
||||
let s:legacy = 1
|
||||
else
|
||||
call system('type fzf')
|
||||
if v:shell_error
|
||||
@ -326,10 +324,7 @@ function! s:cmd_callback(lines) abort
|
||||
endfunction
|
||||
|
||||
function! s:cmd(bang, ...) abort
|
||||
let args = copy(a:000)
|
||||
if !s:legacy
|
||||
let args = insert(args, '--expect=ctrl-t,ctrl-x,ctrl-v', 0)
|
||||
endif
|
||||
let args = extend(['--expect=ctrl-t,ctrl-x,ctrl-v'], a:000)
|
||||
let opts = {}
|
||||
if len(args) > 0 && isdirectory(expand(args[-1]))
|
||||
let opts.dir = remove(args, -1)
|
||||
@ -337,15 +332,10 @@ function! s:cmd(bang, ...) abort
|
||||
if !a:bang
|
||||
let opts.down = get(g:, 'fzf_tmux_height', s:default_tmux_height)
|
||||
endif
|
||||
|
||||
if s:legacy
|
||||
call fzf#run(extend({ 'options': join(args), 'sink': 'e' }, opts))
|
||||
else
|
||||
call fzf#run(extend({ 'options': join(args), 'sink*': function('<sid>cmd_callback') }, opts))
|
||||
endif
|
||||
call fzf#run(extend({'options': join(args), 'sink*': function('<sid>cmd_callback')}, opts))
|
||||
endfunction
|
||||
|
||||
command! -nargs=* -complete=dir -bang FZF call s:cmd('<bang>' == '!', <f-args>)
|
||||
command! -nargs=* -complete=dir -bang FZF call s:cmd(<bang>0, <f-args>)
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
Loading…
Reference in New Issue
Block a user