[[B]Commits] Fix #208

Also fix commands using --expect
This commit is contained in:
Junegunn Choi
2016-09-28 19:07:09 +09:00
parent 7060bbb07b
commit 3271f6c160

View File

@@ -52,7 +52,7 @@ endfunction
function! s:wrap(name, opts, bang) function! s:wrap(name, opts, bang)
" fzf#wrap does not append --expect if sink or sink* is found " fzf#wrap does not append --expect if sink or sink* is found
let opts = copy(a:opts) let opts = copy(a:opts)
if has_key(opts, 'sink*') if get(opts, 'options', '') !~ '--expect' && has_key(opts, 'sink*')
let Sink = remove(opts, 'sink*') let Sink = remove(opts, 'sink*')
let wrapped = fzf#wrap(a:name, opts, a:bang) let wrapped = fzf#wrap(a:name, opts, a:bang)
let wrapped['sink*'] = Sink let wrapped['sink*'] = Sink
@@ -956,12 +956,14 @@ function! s:commits(buffer_local, args)
endif endif
let command = a:buffer_local ? 'BCommits' : 'Commits' let command = a:buffer_local ? 'BCommits' : 'Commits'
let options = s:wrap({ let expect_keys = join(keys(get(g:, 'fzf_action', s:default_action)), ',')
let options = {
\ 'source': source, \ 'source': source,
\ 'sink*': s:function('s:commits_sink'), \ 'sink*': s:function('s:commits_sink'),
\ 'options': '--ansi --multi --no-sort --tiebreak=index --reverse '. \ 'options': '--ansi --multi --no-sort --tiebreak=index --reverse '.
\ '--inline-info --prompt "'.command.'> " --bind=ctrl-s:toggle-sort' \ '--inline-info --prompt "'.command.'> " --bind=ctrl-s:toggle-sort '.
\ }) \ '--expect='.expect_keys
\ }
if a:buffer_local if a:buffer_local
let options.options .= ',ctrl-d --header ":: Press '.s:magenta('CTRL-S', 'Special').' to toggle sort, '.s:magenta('CTRL-D', 'Special').' to diff"' let options.options .= ',ctrl-d --header ":: Press '.s:magenta('CTRL-S', 'Special').' to toggle sort, '.s:magenta('CTRL-D', 'Special').' to diff"'