mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-23 19:32:58 +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
|
||||
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