From 00e5e1c20e4dd059f6b6938d28d94ddb2e46b41a Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Wed, 4 Sep 2013 18:06:57 +0000 Subject: [PATCH] support changing how numbers are displayed in tab mode. resolves #217. --- autoload/airline/extensions/tabline.vim | 9 ++++++++- doc/airline.txt | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/autoload/airline/extensions/tabline.vim b/autoload/airline/extensions/tabline.vim index eafd4e0b..14103328 100644 --- a/autoload/airline/extensions/tabline.vim +++ b/autoload/airline/extensions/tabline.vim @@ -3,6 +3,7 @@ let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.') let s:excludes = get(g:, 'airline#extensions#tabline#excludes', []) +let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0) let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ') let s:buf_modified_symbol = g:airline_symbols.modified @@ -98,7 +99,13 @@ function! s:get_tabs() let b = airline#builder#new({'active': 1}) for i in range(1, tabpagenr('$')) let group = i == tabpagenr() ? 'airline_tabsel' : 'airline_tab' - call b.add_section(group, ' %{len(tabpagebuflist('.i.'))}%( %'.i.'T %{airline#extensions#tabline#title('.i.')} %)') + let val = '%(' + if s:tab_nr_type == 0 + let val .= ' %{len(tabpagebuflist('.i.'))}' + else + let val .= ' '.i + endif + call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)') endfor call b.add_raw('%T') call b.add_section('airline_tabfill', '') diff --git a/doc/airline.txt b/doc/airline.txt index f15b29ba..c79badd9 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -302,6 +302,10 @@ virtualenv * configure filename match rules to exclude from the tabline. > let g:airline#extensions#tabline#excludes = [] < +* configure how numbers are calculated in tab mode. > + let g:airline#extensions#tabline#tab_nr_type = 0 " # of splits (default) + let g:airline#extensions#tabline#tab_nr_type = 1 " tab number +< * configure whether buffer numbers should be shown. > let g:airline#extensions#tabline#buffer_nr_show = 0 <