vim-airline/autoload/airline/extensions/tabline/buflist.vim

43 lines
1.1 KiB
VimL
Raw Normal View History

2015-02-19 07:48:47 +08:00
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
let s:excludes = get(g:, 'airline#extensions#tabline#excludes', [])
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
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