mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-31 01:44:58 +02:00
Merge pull request #1203 from chrisbra/small_screen
small screen adjustments
This commit is contained in:
commit
98b329daf1
@ -162,6 +162,7 @@ function! airline#extensions#branch#head()
|
||||
if empty(b:airline_head) || !found_fugitive_head && !s:check_in_path()
|
||||
let b:airline_head = ''
|
||||
endif
|
||||
let b:airline_head = airline#util#shorten(b:airline_head, 120, 9)
|
||||
return b:airline_head
|
||||
endfunction
|
||||
|
||||
|
@ -106,12 +106,7 @@ function! airline#extensions#whitespace#check()
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
if winwidth(0) < 120 && len(split(b:airline_whitespace_check, '\zs')) > 9
|
||||
return matchstr(b:airline_whitespace_check, '^.\{9\}').'…'
|
||||
else
|
||||
return b:airline_whitespace_check
|
||||
endif
|
||||
|
||||
return airline#util#shorten(b:airline_whitespace_check, 120, 9)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#whitespace#toggle()
|
||||
|
@ -131,7 +131,11 @@ function! airline#init#sections()
|
||||
let g:airline_section_y = airline#section#create_right(['ffenc'])
|
||||
endif
|
||||
if !exists('g:airline_section_z')
|
||||
let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v'])
|
||||
if winwidth(0) > 80
|
||||
let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v'])
|
||||
else
|
||||
let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3v'])
|
||||
endif
|
||||
endif
|
||||
if !exists('g:airline_section_error')
|
||||
let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic', 'eclim'])
|
||||
|
@ -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 ''
|
||||
|
Loading…
x
Reference in New Issue
Block a user