Add a get_tabs function to abstract over tabs
This commit is contained in:
parent
958f78335e
commit
f60cf736db
|
@ -25,6 +25,20 @@ function! airline#extensions#tabline#tabs#invalidate()
|
|||
let s:current_bufnr = -1
|
||||
endfunction
|
||||
|
||||
function! s:get_tabs()
|
||||
let tablist = range(1, tabpagenr('$'))
|
||||
let curbuf = bufnr('%')
|
||||
|
||||
if get(g:, 'airline#extensions#tabline#current_first', 0)
|
||||
" always have current tabpage first
|
||||
if index(tablist, curtab) > -1
|
||||
call remove(tablist, index(tablist, curtab))
|
||||
endif
|
||||
let tablist = [curtab] + tablist
|
||||
endif
|
||||
return tablist
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#get()
|
||||
let curbuf = bufnr('%')
|
||||
let curtab = tabpagenr()
|
||||
|
@ -43,15 +57,7 @@ function! airline#extensions#tabline#tabs#get()
|
|||
let b = airline#extensions#tabline#new_builder()
|
||||
|
||||
call airline#extensions#tabline#add_label(b, 'tabs')
|
||||
" always have current tabpage first
|
||||
let tablist = range(1, tabpagenr('$'))
|
||||
if get(g:, 'airline#extensions#tabline#current_first', 0)
|
||||
if index(tablist, curtab) > -1
|
||||
call remove(tablist, index(tablist, curtab))
|
||||
endif
|
||||
let tablist = [curtab] + tablist
|
||||
endif
|
||||
for i in tablist
|
||||
for i in s:get_tabs()
|
||||
if i == curtab
|
||||
let group = 'airline_tabsel'
|
||||
if g:airline_detect_modified
|
||||
|
|
Loading…
Reference in New Issue