mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-08 05:24:47 +08:00
[Buffers] Do not apply --header-lines when the current buffer is unlisted
Fix #1211
This commit is contained in:
@@ -712,10 +712,12 @@ endfunction
|
|||||||
function! fzf#vim#buffers(...)
|
function! fzf#vim#buffers(...)
|
||||||
let [query, args] = (a:0 && type(a:1) == type('')) ?
|
let [query, args] = (a:0 && type(a:1) == type('')) ?
|
||||||
\ [a:1, a:000[1:]] : ['', a:000]
|
\ [a:1, a:000[1:]] : ['', a:000]
|
||||||
|
let sorted = fzf#vim#_buflisted_sorted()
|
||||||
|
let header_lines = '--header-lines=' . (bufnr('') == get(sorted, 0, 0) ? 1 : 0)
|
||||||
return s:fzf('buffers', {
|
return s:fzf('buffers', {
|
||||||
\ 'source': map(fzf#vim#_buflisted_sorted(), 'fzf#vim#_format_buffer(v:val)'),
|
\ 'source': map(sorted, 'fzf#vim#_format_buffer(v:val)'),
|
||||||
\ 'sink*': s:function('s:bufopen'),
|
\ 'sink*': s:function('s:bufopen'),
|
||||||
\ 'options': ['+m', '-x', '--tiebreak=index', '--header-lines=1', '--ansi', '-d', '\t', '--with-nth', '3..', '-n', '2,1..2', '--prompt', 'Buf> ', '--query', query, '--preview-window', '+{2}-/2']
|
\ 'options': ['+m', '-x', '--tiebreak=index', header_lines, '--ansi', '-d', '\t', '--with-nth', '3..', '-n', '2,1..2', '--prompt', 'Buf> ', '--query', query, '--preview-window', '+{2}-/2']
|
||||||
\}, args)
|
\}, args)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user