diff --git a/autoload/airline/extensions/branch.vim b/autoload/airline/extensions/branch.vim index fadfc31c..5a47f81d 100644 --- a/autoload/airline/extensions/branch.vim +++ b/autoload/airline/extensions/branch.vim @@ -266,8 +266,9 @@ function! airline#extensions#branch#head() endif endif + let winwidth = get(airline#parts#get('branch'), 'minwidth', 120) let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7 - let b:airline_head = airline#util#shorten(b:airline_head, 120, minwidth) + let b:airline_head = airline#util#shorten(b:airline_head, winwidth, minwidth) return b:airline_head endfunction diff --git a/autoload/airline/extensions/hunks.vim b/autoload/airline/extensions/hunks.vim index c04c49e4..310d7597 100644 --- a/autoload/airline/extensions/hunks.vim +++ b/autoload/airline/extensions/hunks.vim @@ -75,9 +75,10 @@ function! airline#extensions#hunks#get_hunks() endif let hunks = s:get_hunks() let string = '' + let winwidth = get(airline#parts#get('hunks'), 'minwidth', 100) if !empty(hunks) for i in [0, 1, 2] - if (s:non_zero_only == 0 && airline#util#winwidth() > 100) || hunks[i] > 0 + if (s:non_zero_only == 0 && airline#util#winwidth() > winwidth) || hunks[i] > 0 let string .= printf('%s%s ', s:hunk_symbols[i], hunks[i]) endif endfor diff --git a/autoload/airline/init.vim b/autoload/airline/init.vim index 5f616370..826243ca 100644 --- a/autoload/airline/init.vim +++ b/autoload/airline/init.vim @@ -151,8 +151,14 @@ function! airline#init#bootstrap() \ 'raw': '/%L%{g:airline_symbols.maxlinenr}', \ 'accent': 'bold'}) call airline#parts#define_function('ffenc', 'airline#parts#ffenc') - call airline#parts#define_empty(['hunks', 'branch', 'obsession', 'tagbar', - \ 'syntastic-warn', 'syntastic-err', 'eclim', 'whitespace','windowswap', + call airline#parts#define('hunks', { + \ 'raw': '', + \ 'minwidth': 100}) + call airline#parts#define('branch', { + \ 'raw': '', + \ 'minwidth': 120}) + call airline#parts#define_empty(['obsession', 'tagbar', 'syntastic-warn', + \ 'syntastic-err', 'eclim', 'whitespace','windowswap', \ 'ycm_error_count', 'ycm_warning_count', 'neomake_error_count', \ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count', \ 'languageclient_error_count', 'languageclient_warning_count'])