mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-22 14:20:15 +08:00
integrate changesPlugin for displaying hunks
This commit is contained in:
parent
44bf6fd1c5
commit
f2ae2bd7d0
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -317,6 +317,7 @@ 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>
|
||||
changesPlugin <https://github.com/chrisbra/changesPlugin>
|
||||
|
||||
* enable/disable showing a summary of changed hunks under source control. >
|
||||
let g:airline#extensions#hunks#enabled = 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user