parent
133a76d2d4
commit
ce83c39bed
14
autoload/airline/extensions/tabline/formatters/tabnr.vim
Normal file
14
autoload/airline/extensions/tabline/formatters/tabnr.vim
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
" MIT License. Copyright (c) 2017 C.Brabandt
|
||||||
|
" vim: et ts=2 sts=2 sw=2
|
||||||
|
|
||||||
|
scriptencoding utf-8
|
||||||
|
|
||||||
|
function! airline#extensions#tabline#formatters#tabnr#format(tab_nr_type, nr)
|
||||||
|
if a:tab_nr_type == 0 " nr of splits
|
||||||
|
return (g:airline_symbols.space).'%{len(tabpagebuflist('.a:nr.'))}'
|
||||||
|
elseif a:tab_nr_type == 1 " tab number
|
||||||
|
return (g:airline_symbols.space).a:nr
|
||||||
|
else "== 2 splits and tab number
|
||||||
|
return (g:airline_symbols.space).a:nr.'.%{len(tabpagebuflist('.a:nr.'))}'
|
||||||
|
endif
|
||||||
|
endfunction
|
@ -68,13 +68,7 @@ function! airline#extensions#tabline#tabs#get()
|
|||||||
let val = '%('
|
let val = '%('
|
||||||
|
|
||||||
if get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
|
if get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
|
||||||
if tab_nr_type == 0
|
let val .= airline#extensions#tabline#tabs#tabnr_formatter(tab_nr_type, i)
|
||||||
let val .= (g:airline_symbols.space).'%{len(tabpagebuflist('.i.'))}'
|
|
||||||
elseif tab_nr_type == 1
|
|
||||||
let val .= (g:airline_symbols.space).i
|
|
||||||
else "== 2
|
|
||||||
let val .= (g:airline_symbols.space).i.'.%{len(tabpagebuflist('.i.'))}'
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)')
|
call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)')
|
||||||
endfor
|
endfor
|
||||||
@ -121,3 +115,8 @@ function! airline#extensions#tabline#tabs#map_keys()
|
|||||||
noremap <silent> <Plug>AirlineSelectNextTab :<C-U>exe repeat(':tabn\|', v:count1)<cr>
|
noremap <silent> <Plug>AirlineSelectNextTab :<C-U>exe repeat(':tabn\|', v:count1)<cr>
|
||||||
let s:airline_tabline_map_key = 1
|
let s:airline_tabline_map_key = 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! airline#extensions#tabline#tabs#tabnr_formatter(nr, i)
|
||||||
|
let formatter = get(g:, 'airline#extensions#tabline#tabnr_formatter', 'tabnr')
|
||||||
|
return airline#extensions#tabline#formatters#{formatter}#format(a:nr, a:i)
|
||||||
|
endfunction
|
||||||
|
@ -685,6 +685,10 @@ with the middle mouse button to delete that buffer.
|
|||||||
let g:airline#extensions#tabline#tab_nr_type = 0 " # of splits (default)
|
let g:airline#extensions#tabline#tab_nr_type = 0 " # of splits (default)
|
||||||
let g:airline#extensions#tabline#tab_nr_type = 1 " tab number
|
let g:airline#extensions#tabline#tab_nr_type = 1 " tab number
|
||||||
let g:airline#extensions#tabline#tab_nr_type = 2 " splits and tab number
|
let g:airline#extensions#tabline#tab_nr_type = 2 " splits and tab number
|
||||||
|
let g:airline#extensions#tabline#tabnr_formatter = 'tabnr'
|
||||||
|
|
||||||
|
Note: last option can be used to specify a different formatter for
|
||||||
|
displaying the numbers. By default tabline/formatter/tabnr.vim is used
|
||||||
<
|
<
|
||||||
* enable/disable displaying tab number in tabs mode. >
|
* enable/disable displaying tab number in tabs mode. >
|
||||||
let g:airline#extensions#tabline#show_tab_nr = 1
|
let g:airline#extensions#tabline#show_tab_nr = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user