Expose get_hunks for advanced customization
This commit is contained in:
parent
45ff435378
commit
5f769dbed9
@ -42,7 +42,7 @@ function! s:get_hunks_empty()
|
|||||||
return ''
|
return ''
|
||||||
endfunction
|
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 !exists('b:source_func') || get(b:, 'source_func', '') is# 's:get_hunks_empty'
|
||||||
if get(g:, 'loaded_signify') && sy#buffer_is_active()
|
if get(g:, 'loaded_signify') && sy#buffer_is_active()
|
||||||
let b:source_func = 's:get_hunks_signify'
|
let b:source_func = 's:get_hunks_signify'
|
||||||
@ -73,7 +73,7 @@ function! airline#extensions#hunks#get_hunks()
|
|||||||
\ get(b:, 'source_func', '') isnot# 's:get_hunks_changes'
|
\ get(b:, 'source_func', '') isnot# 's:get_hunks_changes'
|
||||||
return b:airline_hunks
|
return b:airline_hunks
|
||||||
endif
|
endif
|
||||||
let hunks = s:get_hunks()
|
let hunks = airline#extensions#hunks#get_raw_hunks()
|
||||||
let string = ''
|
let string = ''
|
||||||
let winwidth = get(airline#parts#get('hunks'), 'minwidth', 100)
|
let winwidth = get(airline#parts#get('hunks'), 'minwidth', 100)
|
||||||
if !empty(hunks)
|
if !empty(hunks)
|
||||||
|
@ -632,6 +632,10 @@ vim-signify <https://github.com/mhinz/vim-signify>
|
|||||||
changesPlugin <https://github.com/chrisbra/changesPlugin>
|
changesPlugin <https://github.com/chrisbra/changesPlugin>
|
||||||
quickfixsigns <https://github.com/tomtom/quickfixsigns_vim>
|
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. >
|
* enable/disable showing a summary of changed hunks under source control. >
|
||||||
let g:airline#extensions#hunks#enabled = 1
|
let g:airline#extensions#hunks#enabled = 1
|
||||||
<
|
<
|
||||||
|
Loading…
x
Reference in New Issue
Block a user