From 5f769dbed99d60b655dbda405d0e8dc397854dae Mon Sep 17 00:00:00 2001 From: Max Nordlund gmail Date: Wed, 20 Feb 2019 12:27:58 +0100 Subject: [PATCH] Expose get_hunks for advanced customization --- autoload/airline/extensions/hunks.vim | 4 ++-- doc/airline.txt | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/autoload/airline/extensions/hunks.vim b/autoload/airline/extensions/hunks.vim index 310d7597..9b2dd5ae 100644 --- a/autoload/airline/extensions/hunks.vim +++ b/autoload/airline/extensions/hunks.vim @@ -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,7 +73,7 @@ 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) diff --git a/doc/airline.txt b/doc/airline.txt index 8a45fc2e..0e697b20 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -632,6 +632,10 @@ vim-signify changesPlugin quickfixsigns +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 <