From a950a2938a6b0a9b1908b899173fe74efdc66776 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Tue, 2 May 2017 21:22:47 +0200 Subject: [PATCH] shorten tagbar extension on short windows --- autoload/airline/util.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/autoload/airline/util.vim b/autoload/airline/util.vim index ef11cbe..4246ccd 100644 --- a/autoload/airline/util.vim +++ b/autoload/airline/util.vim @@ -6,9 +6,15 @@ scriptencoding utf-8 call airline#init#bootstrap() let s:spc = g:airline_symbols.space -function! airline#util#shorten(text, winwidth, minwidth) +function! airline#util#shorten(text, winwidth, minwidth, ...) if winwidth(0) < a:winwidth && len(split(a:text, '\zs')) > a:minwidth - return matchstr(a:text, '^.\{'.a:minwidth.'}').'…' + if get(a:000, 0, 0) + " shorten from tail + return '…'.matchstr(a:text, '.\{'.a:minwidth.'}$') + else + " shorten from beginning of string + return matchstr(a:text, '^.\{'.a:minwidth.'}').'…' + endif else return a:text endif