From b2f301f73c168104cf2202ac5f2e2b7c078c7aa1 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Tue, 27 Jun 2017 14:39:11 +0200 Subject: [PATCH] tabline: Cache title as tablocal variable --- autoload/airline/extensions/tabline.vim | 5 ++++- autoload/airline/util.vim | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/autoload/airline/extensions/tabline.vim b/autoload/airline/extensions/tabline.vim index bd3f835e..156f7aa0 100644 --- a/autoload/airline/extensions/tabline.vim +++ b/autoload/airline/extensions/tabline.vim @@ -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 diff --git a/autoload/airline/util.vim b/autoload/airline/util.vim index 4246ccd4..3f940866 100644 --- a/autoload/airline/util.vim +++ b/autoload/airline/util.vim @@ -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()