Merge pull request #1348 from shaunbrady/exclude_at_runtime

Make ...#excludes|exclude_preview runtime configurable
This commit is contained in:
Christian Brabandt 2016-12-06 21:18:38 +01:00 committed by GitHub
commit 0357b4fcbe

View File

@ -3,9 +3,6 @@
scriptencoding utf-8
let s:excludes = get(g:, 'airline#extensions#tabline#excludes', [])
let s:exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1)
function! airline#extensions#tabline#buflist#invalidate()
unlet! s:current_buffer_list
endfunction
@ -15,6 +12,9 @@ function! airline#extensions#tabline#buflist#list()
return s:current_buffer_list
endif
let excludes = get(g:, 'airline#extensions#tabline#excludes', [])
let exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1)
let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$"))
let buffers = []
@ -28,9 +28,9 @@ function! airline#extensions#tabline#buflist#list()
" 2) buffer is a quickfix buffer
" 3) exclude preview windows (if 'bufhidden' == wipe
" and 'buftype' == nofile
if (!empty(s:excludes) && match(bufname(nr), join(s:excludes, '\|')) > -1) ||
if (!empty(excludes) && match(bufname(nr), join(excludes, '\|')) > -1) ||
\ (getbufvar(nr, 'current_syntax') == 'qf') ||
\ (s:exclude_preview && getbufvar(nr, '&bufhidden') == 'wipe'
\ (exclude_preview && getbufvar(nr, '&bufhidden') == 'wipe'
\ && getbufvar(nr, '&buftype') == 'nofile')
continue
endif