From de69bba26e9c90cda94c7cc95babbced8db46872 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Mon, 19 Aug 2013 16:03:10 +0000 Subject: [PATCH] re-enable gitgutter integration with new upstream function. resolves #154 and #153. --- autoload/airline/extensions.vim | 2 +- autoload/airline/extensions/hunks.vim | 31 ++------------------------- plugin/airline.vim | 1 - 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 7eed17d..71f02d6 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -128,7 +128,7 @@ function! airline#extensions#load() call airline#extensions#undotree#init(s:ext) endif - if g:airline_enable_hunks && exists('*GitGutterGetHunks') + if get(g:, 'airline_enable_hunks', 1) && exists('*GitGutterGetHunkSummary') call airline#extensions#hunks#init(s:ext) endif diff --git a/autoload/airline/extensions/hunks.vim b/autoload/airline/extensions/hunks.vim index bfba4b9..d9e9015 100644 --- a/autoload/airline/extensions/hunks.vim +++ b/autoload/airline/extensions/hunks.vim @@ -2,35 +2,8 @@ " vim: et ts=2 sts=2 sw=2 function! airline#extensions#hunks#get_hunks() - if &ft == 'gitcommit' - return '' - endif - - if get(g:, 'gitgutter_initialised', 0) && get(g:, 'gitgutter_enabled', 0) - let added = 0 - let removed = 0 - let changed = 0 - let hunks = GitGutterGetHunks() - for hunk in hunks - if hunk[1] == 0 && hunk[3] > 0 - let added += hunk[3] - elseif hunk[1] > 0 && hunk[3] == 0 - let removed += hunk[1] - elseif hunk[1] > 0 && hunk[3] > 0 - if hunk[1] == hunk[3] - let changed += hunk[3] - elseif hunk[1] < hunk[3] - let changed += hunk[1] - let added += (hunk[3] - hunk[1]) - elseif hunk[1] > hunk[3] - let changed += hunk[3] - let removed += (hunk[1] - hunk[3]) - endif - endif - endfor - return printf('+%s ~%s -%s ', added, changed, removed) - endif - return '' + let hunks = GitGutterGetHunkSummary() + return printf('+%s ~%s -%s ', hunks[0], hunks[1], hunks[2]) endfunction function! airline#extensions#hunks#init(ext) diff --git a/plugin/airline.vim b/plugin/airline.vim index 11de2d6..887aa29 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -21,7 +21,6 @@ call s:check_defined('g:airline_enable_branch', 1) call s:check_defined('g:airline_enable_syntastic', 1) call s:check_defined('g:airline_enable_tagbar', 1) call s:check_defined('g:airline_enable_csv', 1) -call s:check_defined('g:airline_enable_hunks', 0) call s:check_defined('g:airline_detect_iminsert', 0) call s:check_defined('g:airline_detect_modified', 1) call s:check_defined('g:airline_detect_paste', 1)