2016-01-15 02:38:38 +00:00
|
|
|
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
2015-02-18 23:48:47 +00:00
|
|
|
" vim: et ts=2 sts=2 sw=2
|
|
|
|
|
2016-09-24 00:16:30 +00:00
|
|
|
scriptencoding utf-8
|
|
|
|
|
2015-02-18 23:48:47 +00: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
|
|
|
|
|
2016-12-04 04:40:15 +00:00
|
|
|
let excludes = get(g:, 'airline#extensions#tabline#excludes', [])
|
|
|
|
let exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1)
|
|
|
|
|
2016-02-16 20:16:55 +00:00
|
|
|
let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$"))
|
|
|
|
|
2015-02-18 23:48:47 +00:00
|
|
|
let buffers = []
|
2016-02-08 19:34:27 +00:00
|
|
|
" 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.
|
2016-02-16 20:16:55 +00:00
|
|
|
for nr in list
|
2016-02-08 19:34:27 +00:00
|
|
|
if buflisted(nr)
|
|
|
|
" Do not add to the bufferlist, if either
|
|
|
|
" 1) buffername matches exclude pattern
|
|
|
|
" 2) buffer is a quickfix buffer
|
|
|
|
" 3) exclude preview windows (if 'bufhidden' == wipe
|
|
|
|
" and 'buftype' == nofile
|
2016-12-04 04:40:15 +00:00
|
|
|
if (!empty(excludes) && match(bufname(nr), join(excludes, '\|')) > -1) ||
|
2016-02-08 19:34:27 +00:00
|
|
|
\ (getbufvar(nr, 'current_syntax') == 'qf') ||
|
2016-12-04 04:40:15 +00:00
|
|
|
\ (exclude_preview && getbufvar(nr, '&bufhidden') == 'wipe'
|
2016-02-08 19:34:27 +00:00
|
|
|
\ && getbufvar(nr, '&buftype') == 'nofile')
|
|
|
|
continue
|
2015-02-18 23:48:47 +00:00
|
|
|
endif
|
2016-02-08 19:34:27 +00:00
|
|
|
call add(buffers, nr)
|
2015-02-18 23:48:47 +00:00
|
|
|
endif
|
|
|
|
endfor
|
|
|
|
|
|
|
|
let s:current_buffer_list = buffers
|
|
|
|
return buffers
|
|
|
|
endfunction
|
|
|
|
|