Merge pull request #1877 from maxnordlund/resepct-minwidth-for-vcs
Respect minwidth for hunks and branch parts
This commit is contained in:
commit
eb0ddf61dc
@ -266,13 +266,14 @@ function! airline#extensions#branch#head()
|
||||
endif
|
||||
endif
|
||||
|
||||
let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7
|
||||
let b:airline_head = airline#util#shorten(b:airline_head, 120, minwidth)
|
||||
return b:airline_head
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#branch#get_head()
|
||||
let head = airline#extensions#branch#head()
|
||||
let winwidth = get(airline#parts#get('branch'), 'minwidth', 120)
|
||||
let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7
|
||||
let head = airline#util#shorten(head, winwidth, minwidth)
|
||||
let empty_message = get(g:, 'airline#extensions#branch#empty_message', '')
|
||||
let symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch)
|
||||
return empty(head)
|
||||
|
@ -42,7 +42,7 @@ function! s:get_hunks_empty()
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks()
|
||||
function! airline#extensions#hunks#get_raw_hunks()
|
||||
if !exists('b:source_func') || get(b:, 'source_func', '') is# 's:get_hunks_empty'
|
||||
if get(g:, 'loaded_signify') && sy#buffer_is_active()
|
||||
let b:source_func = 's:get_hunks_signify'
|
||||
@ -73,11 +73,12 @@ function! airline#extensions#hunks#get_hunks()
|
||||
\ get(b:, 'source_func', '') isnot# 's:get_hunks_changes'
|
||||
return b:airline_hunks
|
||||
endif
|
||||
let hunks = s:get_hunks()
|
||||
let hunks = airline#extensions#hunks#get_raw_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
|
||||
|
@ -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'])
|
||||
|
@ -143,7 +143,7 @@ values):
|
||||
let g:airline_inactive_collapse=1
|
||||
<
|
||||
* Use alternative seperators for the statusline of inactive windows >
|
||||
let g:airline_inactive_alt_sep=1
|
||||
let g:airline_inactive_alt_sep=1
|
||||
<
|
||||
* themes are automatically selected based on the matching colorscheme. this
|
||||
can be overridden by defining a value. >
|
||||
@ -233,7 +233,7 @@ values):
|
||||
<
|
||||
* Display the statusline in the tabline (first top line): >
|
||||
let g:airline_statusline_ontop = 1
|
||||
<
|
||||
<
|
||||
Setting this option, allows to use the statusline option to be used by
|
||||
a custom function or another plugin, since airline won't change it.
|
||||
|
||||
@ -632,6 +632,10 @@ vim-signify <https://github.com/mhinz/vim-signify>
|
||||
changesPlugin <https://github.com/chrisbra/changesPlugin>
|
||||
quickfixsigns <https://github.com/tomtom/quickfixsigns_vim>
|
||||
|
||||
You can use `airline#extensions#hunks#get_raw_hunks()` to get the full hunks,
|
||||
without shortening. This allows for advanced customization, or a quick way of
|
||||
querying how many changes you got. It will return something like '+4 ~2 -1'.
|
||||
|
||||
* enable/disable showing a summary of changed hunks under source control. >
|
||||
let g:airline#extensions#hunks#enabled = 1
|
||||
<
|
||||
@ -824,7 +828,7 @@ with the middle mouse button to delete that buffer.
|
||||
|
||||
Note: last option can be used to specify a different formatter for
|
||||
displaying the numbers. By default tabline/formatter/tabnr.vim is used
|
||||
The argument of that setting should either be a filename that exists
|
||||
The argument of that setting should either be a filename that exists
|
||||
autoload/airline/extensions/tabline/formatter/ (without .vim extension)
|
||||
and needs to provide a format() function. Alternatively you can use a
|
||||
custom function name, that is defined e.g. in your .vimrc file. In any
|
||||
@ -1157,7 +1161,7 @@ virtualenv <https://github.com/jmcantrell/vim-virtualenv>
|
||||
" (see above at g:airline#extensions#whitespace#checks)
|
||||
" To disable mixed-indent-file for go files use:
|
||||
let g:airline#extensions#whitespace#skip_indent_check_ft = {'go': ['mixed-indent-file']}
|
||||
<
|
||||
<
|
||||
------------------------------------- *airline-windowswap*
|
||||
vim-windowswap <https://github.com/wesQ3/vim-windowswap>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user