2016-01-15 10:38:38 +08:00
|
|
|
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
2015-02-19 07:48:47 +08:00
|
|
|
" vim: et ts=2 sts=2 sw=2
|
|
|
|
|
|
|
|
let s:excludes = get(g:, 'airline#extensions#tabline#excludes', [])
|
2015-06-29 04:34:37 +08:00
|
|
|
let s:exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1)
|
2015-02-19 07:48:47 +08:00
|
|
|
|
|
|
|
function! airline#extensions#tabline#buflist#invalidate()
|
|
|
|
unlet! s:current_buffer_list
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! airline#extensions#tabline#buflist#list()
|
|
|
|
if exists('s:current_buffer_list')
|
|
|
|
return s:current_buffer_list
|
|
|
|
endif
|
|
|
|
|
|
|
|
let buffers = []
|
|
|
|
let cur = bufnr('%')
|
|
|
|
for nr in range(1, bufnr('$'))
|
|
|
|
if buflisted(nr) && bufexists(nr)
|
|
|
|
let toadd = 1
|
|
|
|
for ex in s:excludes
|
|
|
|
if match(bufname(nr), ex) >= 0
|
|
|
|
let toadd = 0
|
|
|
|
break
|
|
|
|
endif
|
|
|
|
endfor
|
|
|
|
if getbufvar(nr, 'current_syntax') == 'qf'
|
|
|
|
let toadd = 0
|
|
|
|
endif
|
2015-06-29 04:34:37 +08:00
|
|
|
if s:exclude_preview && getbufvar(nr, '&bufhidden') == 'wipe' && getbufvar(nr, '&buftype') == 'nofile'
|
|
|
|
let toadd = 0
|
|
|
|
endif
|
2015-02-19 07:48:47 +08:00
|
|
|
if toadd
|
|
|
|
call add(buffers, nr)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endfor
|
|
|
|
|
|
|
|
let s:current_buffer_list = buffers
|
|
|
|
return buffers
|
|
|
|
endfunction
|
|
|
|
|