diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 461d1c3..c6408d5 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -148,7 +148,7 @@ function! airline#extensions#load() endif if (get(g:, 'airline#extensions#hunks#enabled', 1) && get(g:, 'airline_enable_hunks', 1)) - \ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter')) + \ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter') || exists('g:loaded_changes')) call airline#extensions#hunks#init(s:ext) endif diff --git a/autoload/airline/extensions/hunks.vim b/autoload/airline/extensions/hunks.vim index 6827f5d..968fd66 100644 --- a/autoload/airline/extensions/hunks.vim +++ b/autoload/airline/extensions/hunks.vim @@ -1,7 +1,7 @@ " MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 -if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) +if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0) finish endif @@ -27,6 +27,19 @@ function! s:get_hunks_gitgutter() return GitGutterGetHunkSummary() endfunction +function! s:get_hunks_changes() + if !get(b:, 'changes_view_enabled', 0) || s:is_branch_empty() + return [] + endif + let hunks = changes#GetStats() + for i in hunks + if i > 0 + return hunks + endif + endfor + return [] +endfunction + function! s:get_hunks_empty() return '' endfunction @@ -38,6 +51,8 @@ function! s:get_hunks() let s:source_func = 's:get_hunks_signify' elseif exists('*GitGutterGetHunkSummary') let s:source_func = 's:get_hunks_gitgutter' + elseif exists('*changes#GetStats') + let s:source_func = 's:get_hunks_changes' else let s:source_func = 's:get_hunks_empty' endif diff --git a/doc/airline.txt b/doc/airline.txt index aef174b..1206a65 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -317,6 +317,7 @@ csv.vim ------------------------------------- *airline-hunks* vim-gitgutter vim-signify +changesPlugin * enable/disable showing a summary of changed hunks under source control. > let g:airline#extensions#hunks#enabled = 1