mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-23 14:47:18 +08:00
shorten tagbar extension on short windows
This commit is contained in:
parent
0c368681dd
commit
a950a2938a
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user