shorten tagbar extension on short windows

This commit is contained in:
Christian Brabandt 2017-05-02 21:22:47 +02:00
parent 0c368681dd
commit a950a2938a
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 8 additions and 2 deletions

View File

@ -6,9 +6,15 @@ scriptencoding utf-8
call airline#init#bootstrap() call airline#init#bootstrap()
let s:spc = g:airline_symbols.space 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 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 else
return a:text return a:text
endif endif