Merge pull request #945 from chrisbra/bufadd_ignore

fix issue #939
This commit is contained in:
Christian Brabandt 2016-01-26 20:58:10 +01:00
commit 020ee382dc
2 changed files with 12 additions and 1 deletions

View File

@ -4,7 +4,7 @@
let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default')
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
let s:ignore_bufadd_pat = get(g:, 'airline#extensions#tabline#ignore_bufadd_pat', '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree')
let s:taboo = get(g:, 'airline#extensions#taboo#enabled', 1) && get(g:, 'loaded_taboo', 0)
if s:taboo
let g:taboo_tabline = 0
@ -38,10 +38,16 @@ function! s:toggle_on()
endfunction
function! s:update_tabline()
let match = expand('<afile>')
if pumvisible()
return
elseif !get(g:, 'airline#extensions#tabline#enabled', 0)
return
" return, if buffer matches ignore pattern or is directory (netrw)
elseif empty(match)
\ || match(match, s:ignore_bufadd_pat) > -1
\ || isdirectory(expand("<afile>"))
return
endif
" force re-evaluation of tabline setting
set mod!

View File

@ -567,6 +567,11 @@ exposed.
* configure symbol used to represent close button
let g:airline#extensions#tabline#close_symbol = 'X'
* configure pattern to be ignored on BufAdd autocommand >
" fixes unneccessary redraw, when e.g. opening Gundo window
let airline#extensions#tabline#ignore_bufadd_pat =
\ '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree'
<
Note: Enabling this extension will modify 'showtabline' and 'guioptions'.