Merge pull request #816 from mildred/master

Make tabline compatible with bufmru
This commit is contained in:
Christian Brabandt 2016-02-17 07:42:42 +01:00
commit 8af213d3f9
2 changed files with 5 additions and 1 deletions

View File

@ -37,6 +37,8 @@ function! airline#extensions#tabline#buffers#on()
augroup airline_tabline_buffers augroup airline_tabline_buffers
autocmd! autocmd!
autocmd BufDelete * call airline#extensions#tabline#buffers#invalidate() autocmd BufDelete * call airline#extensions#tabline#buffers#invalidate()
autocmd User BufMRUChange call airline#extensions#tabline#buflist#invalidate()
autocmd User BufMRUChange call airline#extensions#tabline#buffers#invalidate()
augroup END augroup END
endfunction endfunction

View File

@ -13,11 +13,13 @@ function! airline#extensions#tabline#buflist#list()
return s:current_buffer_list return s:current_buffer_list
endif endif
let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$"))
let buffers = [] let buffers = []
" If this is too slow, we can switch to a different algorithm. " If this is too slow, we can switch to a different algorithm.
" Basically branch 535 already does it, but since it relies on " Basically branch 535 already does it, but since it relies on
" BufAdd autocommand, I'd like to avoid this if possible. " BufAdd autocommand, I'd like to avoid this if possible.
for nr in range(1, bufnr('$')) for nr in list
if buflisted(nr) if buflisted(nr)
" Do not add to the bufferlist, if either " Do not add to the bufferlist, if either
" 1) buffername matches exclude pattern " 1) buffername matches exclude pattern