mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-25 09:41:33 +08:00
pass in buffers to the formatter.
This commit is contained in:
parent
0ac25ecc30
commit
2e46190034
|
@ -80,7 +80,7 @@ function! airline#extensions#tabline#title(n)
|
|||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#get_buffer_name(nr)
|
||||
return airline#extensions#tabline#formatters#{s:formatter}(a:nr)
|
||||
return airline#extensions#tabline#formatters#{s:formatter}(a:nr, get(s:, 'current_buffer_list', []))
|
||||
endfunction
|
||||
|
||||
function! s:get_buffer_list()
|
||||
|
@ -106,6 +106,7 @@ function! s:get_buffer_list()
|
|||
let buffers = buffers[:s:buf_max]
|
||||
endif
|
||||
|
||||
let s:current_buffer_list = buffers
|
||||
return buffers
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s
|
|||
let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
|
||||
let s:buf_modified_symbol = g:airline_symbols.modified
|
||||
|
||||
function! airline#extensions#tabline#formatters#default(bufnr)
|
||||
function! airline#extensions#tabline#formatters#default(bufnr, buffers)
|
||||
let _ = ''
|
||||
|
||||
if s:buf_nr_show
|
||||
|
|
|
@ -316,7 +316,7 @@ virtualenv <https://github.com/jmcantrell/vim-virtualenv>
|
|||
let g:airline#extensions#tabline#formatter = 'default'
|
||||
|
||||
" here is how you can define a 'foo' formatter:
|
||||
function! airline#extensions#tabline#formatters#foo(bufnr)
|
||||
function! airline#extensions#tabline#formatters#foo(bufnr, buffers)
|
||||
return fnamemodify(bufname(a:bufnr), ':t')
|
||||
endfunction
|
||||
let g:airline#extensions#tabline#formatter = 'foo'
|
||||
|
|
Loading…
Reference in New Issue
Block a user