support vim-signify as a hunk source.

This commit is contained in:
Bailey Ling 2013-08-20 15:43:26 +00:00
parent 35db000651
commit a04d7c277a
4 changed files with 32 additions and 7 deletions

View File

@ -7,7 +7,7 @@ Lean & mean statusline for vim that's light as air.
# Features
* tiny core written with extensibility in mind ([open/closed principle][8]).
* integrates with a variety of plugins, including: [vim-bufferline][6], [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], [undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29], [syntastic][5] and [lawrencium][21].
* integrates with a variety of plugins, including: [vim-bufferline][6], [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], [undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29], [vim-signify][30], [syntastic][5] and [lawrencium][21].
* looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols.
* optimized for speed; it loads in under a millisecond.
* fully customizable; if you know a little `statusline` syntax you can tweak it to your needs.
@ -136,3 +136,4 @@ MIT license. Copyright (c) 2013 Bailey Ling.
[27]: https://github.com/bling/vim-airline/wiki/FAQ
[28]: https://github.com/chrisbra/csv.vim
[29]: https://github.com/airblade/vim-gitgutter
[30]: https://github.com/mhinz/vim-signify

View File

@ -129,7 +129,7 @@ function! airline#extensions#load()
endif
if (get(g:, 'airline#extensions#hunks#enabled', 1) && get(g:, 'airline_enable_hunks', 1))
\ && exists('*GitGutterGetHunkSummary')
\ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter'))
call airline#extensions#hunks#init(s:ext)
endif

View File

@ -4,11 +4,34 @@
let s:non_zero_only = get(g:, 'airline#extensions#hunks#non_zero_only', 0)
let s:hunk_symbols = get(g:, 'airline#extensions#hunks#hunk_symbols', ['+', '~', '-'])
function! airline#extensions#hunks#get_hunks()
if get(g:, 'gitgutter_enabled', 0) == 0
return ''
let s:initialized = 0
function! s:init()
if !s:initialized
let s:initialized = 1
if exists('*sy#repo#get_stats')
function! s:get_hunks()
let hunks = sy#repo#get_stats()
return hunks
endfunction
elseif exists('*GitGutterGetHunkSummary')
function! s:get_hunks()
if !get(g:, 'gitgutter_enabled', 0)
return ''
endif
return GitGutterGetHunkSummary()
endfunction
else
let s:non_zero_only = 1
function! s:get_hunks()
return [0, 0, 0]
endfunction
endif
endif
let hunks = GitGutterGetHunkSummary()
endfunction
function! airline#extensions#hunks#get_hunks()
call <sid>init()
let hunks = s:get_hunks()
let string = ''
for i in [0, 1, 2]
if s:non_zero_only == 0 || hunks[i] > 0

View File

@ -203,8 +203,9 @@ csv.vim <https://github.com/chrisbra/csv.vim>
<
*airline-hunks*
vim-gitgutter <https://github.com/airblade/vim-gitgutter>
vim-signify <https://github.com/mhinz/vim-signify>
* enable/disable detecting changed hunks under source control. >
* enable/disable showing a summary of changed hunks under source control.
let g:airline#extensions#hunks#enabled = 1
<
* enable/disable showing only non-zero hunks. >