mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-12-06 20:24:27 +08:00
refactor shortening code
This commit is contained in:
@@ -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 ''
|
||||
|
||||
Reference in New Issue
Block a user