Improve tabline + buffer_min_count behaviour

Use BufEnter and BufUnload in place of CursorMoved.

Fixes #479
This commit is contained in:
maek 2014-11-10 15:25:09 +01:00
parent be6e4d6dd6
commit f8645fb654

View File

@ -62,9 +62,10 @@ function! s:toggle_on()
augroup airline_tabline augroup airline_tabline
autocmd! autocmd!
if s:show_buffers == 1 if s:show_buffers == 1
autocmd CursorMoved * call <sid>on_cursormove(s:buf_min_count, len(s:get_buffer_list())) autocmd BufEnter * call <sid>show_tabline(s:buf_min_count, len(s:get_buffer_list()))
autocmd BufUnload * call <sid>show_tabline(s:buf_min_count, len(s:get_buffer_list()) - 1)
else else
autocmd TabEnter * call <sid>on_cursormove(s:tab_min_count, tabpagenr('$')) autocmd TabEnter * call <sid>show_tabline(s:tab_min_count, tabpagenr('$'))
endif endif
augroup END augroup END
endif endif
@ -94,7 +95,7 @@ function! airline#extensions#tabline#load_theme(palette)
call airline#highlighter#exec('airline_tabhid', l:tabhid) call airline#highlighter#exec('airline_tabhid', l:tabhid)
endfunction endfunction
function! s:on_cursormove(min_count, total_count) function! s:show_tabline(min_count, total_count)
if a:total_count >= a:min_count if a:total_count >= a:min_count
if &showtabline != 2 if &showtabline != 2
set showtabline=2 set showtabline=2