extensions: fix tabnr formatter

related #2616
This commit is contained in:
Christian Brabandt
2023-01-16 22:58:54 +01:00
parent 1ecbc76682
commit 82aeea1276
3 changed files with 19 additions and 6 deletions

View File

@@ -3,8 +3,22 @@
scriptencoding utf-8
function! airline#extensions#tabline#formatters#tabnr#format(nr, buflist)
function! airline#extensions#tabline#formatters#tabnr#format(tab_nr, buflist)
let spc=g:airline_symbols.space
let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
if tab_nr_type == 0 " nr of splits
" TODO: What should be returned here: Just the buffer number?
" the following would return the buffer_number/list_of_splits
" return spc. a:tab_nr. '/'. len(a:buflist)
" for now, return the buffer number
return spc. a:tab_nr
elseif tab_nr_type == 1 " tab number
" Return only the current tab number
return spc. a:tab_nr
else " tab_nr_type == 2 splits and tab number
" return the tab number followed by the number of buffers (in the tab)
return spc. a:tab_nr. spc. len(tabpagebuflist(a:buflist[0]))
endif
return printf("%s %d/%d", spc, a:nr, len(tabpagebuflist(a:nr)))
" return printf("%s %d/%d", spc, a:nr, len(tabpagebuflist(a:nr)))
endfunction