summaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-04-14 10:46:20 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-04-14 10:46:20 +0900
commit319d6ced80712eedc818d6d9f9982be4860b2c01 (patch)
tree24208b52e27a1af50f410b3628ab46a72823c859 /plugin
parent51a19a280416577a2175a7b778a7ab57a0601dd6 (diff)
[vim] Simplify :FZF
Ruby version can also accept `--expect` option although it's ignored.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/fzf.vim16
1 files changed, 3 insertions, 13 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim
index 00f0e19a..f08e0177 100644
--- a/plugin/fzf.vim
+++ b/plugin/fzf.vim
@@ -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