Move tabline evaluation into its own function
This commit is contained in:
parent
e0791cc1a0
commit
3305410982
@ -84,6 +84,17 @@ function! s:get_visible_tabs(width)
|
|||||||
return tablist
|
return tablist
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:evaluate_tabline(tabline)
|
||||||
|
let tabline = a:tabline
|
||||||
|
let tabline = substitute(tabline, '%{\([^}]\+\)}', '\=eval(submatch(1))', 'g')
|
||||||
|
let tabline = substitute(tabline, '%#[^#]\+#', '', 'g')
|
||||||
|
let tabline = substitute(tabline, '%(\([^)]\+\))', '\1', 'g')
|
||||||
|
let tabline = substitute(tabline, '%\d\+[TX]', '', 'g')
|
||||||
|
let tabline = substitute(tabline, '%=', '', 'g')
|
||||||
|
let tabline = substitute(tabline, '%\d*\*', '', 'g')
|
||||||
|
return tabline
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#tabline#tabs#get()
|
function! airline#extensions#tabline#tabs#get()
|
||||||
let curbuf = bufnr('%')
|
let curbuf = bufnr('%')
|
||||||
let curtab = tabpagenr()
|
let curtab = tabpagenr()
|
||||||
@ -123,13 +134,7 @@ function! airline#extensions#tabline#tabs#get()
|
|||||||
call airline#extensions#tabline#add_label(b, 'buffers')
|
call airline#extensions#tabline#add_label(b, 'buffers')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let b_tabline = b.build()
|
let b_tabline = s:evaluate_tabline(b.build())
|
||||||
let b_tabline = substitute(b_tabline, '%{\([^}]\+\)}', '\=eval(submatch(1))', 'g')
|
|
||||||
let b_tabline = substitute(b_tabline, '%#[^#]\+#', '', 'g')
|
|
||||||
let b_tabline = substitute(b_tabline, '%(\([^)]\+\))', '\1', 'g')
|
|
||||||
let b_tabline = substitute(b_tabline, '%\d\+[TX]', '', 'g')
|
|
||||||
let b_tabline = substitute(b_tabline, '%=', '', 'g')
|
|
||||||
let b_tabline = substitute(b_tabline, '%\d*\*', '', 'g')
|
|
||||||
|
|
||||||
for i in s:get_visible_tabs(&columns - strlen(b_tabline))
|
for i in s:get_visible_tabs(&columns - strlen(b_tabline))
|
||||||
if i < 0
|
if i < 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user