support vim-signify as a hunk source.
This commit is contained in:
parent
35db000651
commit
a04d7c277a
|
@ -7,7 +7,7 @@ Lean & mean statusline for vim that's light as air.
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
* tiny core written with extensibility in mind ([open/closed principle][8]).
|
* 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.
|
* 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.
|
* 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.
|
* 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
|
[27]: https://github.com/bling/vim-airline/wiki/FAQ
|
||||||
[28]: https://github.com/chrisbra/csv.vim
|
[28]: https://github.com/chrisbra/csv.vim
|
||||||
[29]: https://github.com/airblade/vim-gitgutter
|
[29]: https://github.com/airblade/vim-gitgutter
|
||||||
|
[30]: https://github.com/mhinz/vim-signify
|
||||||
|
|
|
@ -129,7 +129,7 @@ function! airline#extensions#load()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if (get(g:, 'airline#extensions#hunks#enabled', 1) && get(g:, 'airline_enable_hunks', 1))
|
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)
|
call airline#extensions#hunks#init(s:ext)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,34 @@
|
||||||
let s:non_zero_only = get(g:, 'airline#extensions#hunks#non_zero_only', 0)
|
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', ['+', '~', '-'])
|
let s:hunk_symbols = get(g:, 'airline#extensions#hunks#hunk_symbols', ['+', '~', '-'])
|
||||||
|
|
||||||
function! airline#extensions#hunks#get_hunks()
|
let s:initialized = 0
|
||||||
if get(g:, 'gitgutter_enabled', 0) == 0
|
function! s:init()
|
||||||
return ''
|
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
|
endif
|
||||||
let hunks = GitGutterGetHunkSummary()
|
endfunction
|
||||||
|
|
||||||
|
function! airline#extensions#hunks#get_hunks()
|
||||||
|
call <sid>init()
|
||||||
|
let hunks = s:get_hunks()
|
||||||
let string = ''
|
let string = ''
|
||||||
for i in [0, 1, 2]
|
for i in [0, 1, 2]
|
||||||
if s:non_zero_only == 0 || hunks[i] > 0
|
if s:non_zero_only == 0 || hunks[i] > 0
|
||||||
|
|
|
@ -203,8 +203,9 @@ csv.vim <https://github.com/chrisbra/csv.vim>
|
||||||
<
|
<
|
||||||
*airline-hunks*
|
*airline-hunks*
|
||||||
vim-gitgutter <https://github.com/airblade/vim-gitgutter>
|
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
|
let g:airline#extensions#hunks#enabled = 1
|
||||||
<
|
<
|
||||||
* enable/disable showing only non-zero hunks. >
|
* enable/disable showing only non-zero hunks. >
|
||||||
|
|
Loading…
Reference in New Issue