mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-07 13:14:30 +08:00
[Buffers] Allow query argument (#286)
This commit is contained in:
committed by
Junegunn Choi
parent
bac82a954f
commit
3e8ac82cbb
@@ -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
|
||||
|
||||
" ------------------------------------------------------------------
|
||||
|
||||
@@ -41,7 +41,7 @@ call s:defs([
|
||||
\'command! -bang -nargs=? -complete=dir Files call fzf#vim#files(<q-args>, <bang>0)',
|
||||
\'command! -bang -nargs=? GitFiles call fzf#vim#gitfiles(<q-args>, <bang>0)',
|
||||
\'command! -bang -nargs=? GFiles call fzf#vim#gitfiles(<q-args>, <bang>0)',
|
||||
\'command! -bar -bang Buffers call fzf#vim#buffers(<bang>0)',
|
||||
\'command! -bar -bang -nargs=? -complete=buffer Buffers call fzf#vim#buffers(<q-args>, <bang>0)',
|
||||
\'command! -bang -nargs=* Lines call fzf#vim#lines(<q-args>, <bang>0)',
|
||||
\'command! -bang -nargs=* BLines call fzf#vim#buffer_lines(<q-args>, <bang>0)',
|
||||
\'command! -bar -bang Colors call fzf#vim#colors(<bang>0)',
|
||||
|
||||
Reference in New Issue
Block a user