[Buffers] Allow query argument (#286)

This commit is contained in:
Theo Belaire
2017-01-10 21:24:07 -05:00
committed by Junegunn Choi
parent bac82a954f
commit 3e8ac82cbb
2 changed files with 26 additions and 23 deletions

View File

@@ -548,11 +548,14 @@ endfunction
function! fzf#vim#buffers(...)
let bufs = map(sort(s:buflisted(), 's:sort_buffers'), 's:format_buffer(v:val)')
let [query, args] = (a:0 && type(a:1) == type('')) ?
\ [a:1, a:000[1:]] : ['', a:000]
return s:fzf('buffers', {
\ 'source': reverse(bufs),
\ 'sink*': s:function('s:bufopen'),
\ 'options': '+m -x --tiebreak=index --header-lines=1 --ansi -d "\t" -n 2,1..2 --prompt="Buf> "',
\}, a:000)
\ 'options': '+m -x --tiebreak=index --header-lines=1 --ansi -d "\t" -n 2,1..2 --prompt="Buf> "'.s:q(query)
\}, args)
endfunction
" ------------------------------------------------------------------