tabline: Ignore buffers in buflist matching ignore_bufadd_pat

closes #1777
This commit is contained in:
Christian Brabandt 2018-09-20 10:26:32 +02:00
parent a60eabb82f
commit 012229fe08
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
2 changed files with 7 additions and 4 deletions

View File

@ -48,8 +48,6 @@ function! s:update_tabline()
return return
endif endif
let match = expand('<afile>') let match = expand('<afile>')
let ignore_bufadd_pat = get(g:, 'airline#extensions#tabline#ignore_bufadd_pat',
\ '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree|startify')
if pumvisible() if pumvisible()
return return
elseif !get(g:, 'airline#extensions#tabline#enabled', 0) elseif !get(g:, 'airline#extensions#tabline#enabled', 0)

View File

@ -36,6 +36,7 @@ function! airline#extensions#tabline#buflist#list()
let exclude_buffers = get(g:, 'airline#extensions#tabline#exclude_buffers', []) let exclude_buffers = get(g:, 'airline#extensions#tabline#exclude_buffers', [])
let exclude_paths = get(g:, 'airline#extensions#tabline#excludes', []) let exclude_paths = get(g:, 'airline#extensions#tabline#excludes', [])
let exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1) let exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1)
let exclude_types = get(g:, 'g:airline#extensions#tabline#ignore_bufadd_pat', [])
let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$")) let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$"))
@ -52,14 +53,18 @@ function! airline#extensions#tabline#buflist#list()
" 4) when excluding preview windows: " 4) when excluding preview windows:
" 'bufhidden' == wipe " 'bufhidden' == wipe
" 'buftype' == nofile " 'buftype' == nofile
" 5) ignore buffers matching airline#extensions#tabline#ignore_bufadd_pat
" check buffer numbers first " check buffer numbers first
if index(exclude_buffers, nr) >= 0 if index(exclude_buffers, nr) >= 0
continue continue
" check paths second " check paths second
elseif !empty(exclude_paths) && s:ExcludePaths(nr, exclude_paths) elseif !empty(exclude_paths) && s:ExcludePaths(nr, exclude_paths)
continue continue
" check other types last " ignore buffers matching airline#extensions#tabline#ignore_bufadd_pat
elseif airline#util#ignore_buf(bufname(nr))
continue
" check other types last
elseif s:ExcludeOther(nr, exclude_preview) elseif s:ExcludeOther(nr, exclude_preview)
continue continue
endif endif