pass in buffers to the formatter.

This commit is contained in:
Bailey Ling 2013-09-07 00:51:58 +00:00
parent 0ac25ecc30
commit 2e46190034
3 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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'