Make tabline compatible with bufmru

This commit is contained in:
Shanti Bouchez-Mongardé 2016-02-16 21:16:55 +01:00
parent d632c88751
commit faa7a18242
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
autocmd!
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
endfunction

View File

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