refactor shortening code

This commit is contained in:
Christian Brabandt
2016-07-02 09:49:05 +02:00
parent 5b00d54cd6
commit 409e8b0cbd
3 changed files with 10 additions and 9 deletions

View File

@@ -4,6 +4,14 @@
call airline#init#bootstrap()
let s:spc = g:airline_symbols.space
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.'}').'…'
else
return a:text
endif
endfunction
function! airline#util#wrap(text, minwidth)
if a:minwidth > 0 && winwidth(0) < a:minwidth
return ''