From 98c2dbd04ebd996307307e7ca694eeb62518cc20 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 11 Feb 2015 00:31:39 +0100 Subject: [PATCH] tabline: fix cache invalidation for show_buffers=1 with `:bd` Ref: https://github.com/bling/vim-airline/pull/700#issuecomment-73798679 --- autoload/airline/extensions/tabline.vim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/autoload/airline/extensions/tabline.vim b/autoload/airline/extensions/tabline.vim index 978eacdc..df990030 100644 --- a/autoload/airline/extensions/tabline.vim +++ b/autoload/airline/extensions/tabline.vim @@ -61,19 +61,20 @@ function! s:toggle_on() set tabline=%!airline#extensions#tabline#get() augroup airline_tabline autocmd! - " Invalidate cache. - autocmd BufAdd,BufUnload * unlet! s:current_buffer_list - if s:buf_min_count <= 0 && s:tab_min_count <= 1 set showtabline=2 else if s:show_buffers == 1 - autocmd BufEnter * call show_tabline(s:buf_min_count, len(s:get_buffer_list())) + autocmd BufEnter * call show_tabline(s:buf_min_count, len(s:get_buffer_list())) autocmd BufUnload * call show_tabline(s:buf_min_count, len(s:get_buffer_list()) - 1) else - autocmd TabEnter * call show_tabline(s:tab_min_count, tabpagenr('$')) + autocmd TabEnter * call show_tabline(s:tab_min_count, tabpagenr('$')) endif endif + + " Invalidate cache. This has to come after the BufUnload for + " s:show_buffers, to invalidate the cache for BufEnter. + autocmd BufAdd,BufUnload * unlet! s:current_buffer_list augroup END endfunction