From fc6cf26ac63f01733fa545d8ffc6ea6431440b9b Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Thu, 5 Sep 2013 17:07:31 +0000 Subject: [PATCH 1/2] limit the number of buffers displayed. fixes #221. --- autoload/airline/extensions/tabline.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/autoload/airline/extensions/tabline.vim b/autoload/airline/extensions/tabline.vim index 27de830..31193df 100644 --- a/autoload/airline/extensions/tabline.vim +++ b/autoload/airline/extensions/tabline.vim @@ -20,6 +20,9 @@ let s:builder_context = { let s:buf_min_count = get(g:, 'airline#extensions#tabline#buffer_min_count', 0) let s:buf_len = 0 +" TODO: temporary +let s:buf_max = get(g:, 'airline#extensions#tabline#buffer_max', 6) + function! airline#extensions#tabline#init(ext) if has('gui_running') set guioptions-=e @@ -111,6 +114,16 @@ function! s:get_buffer_list() call add(buffers, nr) endif endfor + + " TODO: temporary fix; force the active buffer to be first when there are many buffers open + if len(buffers) > s:buf_max + while buffers[0] != cur + let first = remove(buffers, 0) + call add(buffers, first) + endwhile + let buffers = buffers[:s:buf_max] + endif + return buffers endfunction From e1be8ff22f3885c0f0e521e8a102e225ad060f68 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Thu, 5 Sep 2013 17:17:04 +0000 Subject: [PATCH 2/2] just in case...defense coding. --- autoload/airline/extensions/tabline.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/airline/extensions/tabline.vim b/autoload/airline/extensions/tabline.vim index 31193df..f3e64f0 100644 --- a/autoload/airline/extensions/tabline.vim +++ b/autoload/airline/extensions/tabline.vim @@ -116,7 +116,7 @@ function! s:get_buffer_list() endfor " TODO: temporary fix; force the active buffer to be first when there are many buffers open - if len(buffers) > s:buf_max + if len(buffers) > s:buf_max && index(buffers, cur) > -1 while buffers[0] != cur let first = remove(buffers, 0) call add(buffers, first)