tabline: Cache title as tablocal variable

This commit is contained in:
Christian Brabandt 2017-06-27 14:39:11 +02:00
parent 174b7e1962
commit b2f301f73c
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
2 changed files with 7 additions and 1 deletions

View File

@ -146,11 +146,14 @@ function! airline#extensions#tabline#title(n)
let buflist = tabpagebuflist(a:n)
let winnr = tabpagewinnr(a:n)
let all_buffers = airline#extensions#tabline#buflist#list()
return airline#extensions#tabline#get_buffer_name(
let title = airline#extensions#tabline#get_buffer_name(
\ buflist[winnr - 1],
\ filter(buflist, 'index(all_buffers, v:val) != -1'))
endif
if exists("*settabvar") && !empty(title)
call settabvar(a:n, 'title', title)
endif
return title
endfunction

View File

@ -1,6 +1,9 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
" TODO: Try to cache winwidth(0) function
" e.g. store winwidth per window and access that, only update it, if the size
" actually changed.
scriptencoding utf-8
call airline#init#bootstrap()