Merge pull request #922 from mhinz/i-cant-think-of-a-good-name-for-this

Hunks: make s:source_func local to buffer
This commit is contained in:
Christian Brabandt 2016-01-15 13:16:05 +01:00
commit 06723fc82c

View File

@ -44,22 +44,21 @@ function! s:get_hunks_empty()
return '' return ''
endfunction endfunction
let s:source_func = ''
function! s:get_hunks() function! s:get_hunks()
if empty(s:source_func) if !exists('b:source_func')
if get(g:, 'loaded_signify', 0) if get(g:, 'loaded_signify') && sy#buffer_is_active()
let s:source_func = 's:get_hunks_signify' let b:source_func = 's:get_hunks_signify'
elseif exists('*GitGutterGetHunkSummary') elseif exists('*GitGutterGetHunkSummary')
let s:source_func = 's:get_hunks_gitgutter' let b:source_func = 's:get_hunks_gitgutter'
elseif exists('*changes#GetStats') elseif exists('*changes#GetStats')
let s:source_func = 's:get_hunks_changes' let b:source_func = 's:get_hunks_changes'
elseif exists('*quickfixsigns#vcsdiff#GetHunkSummary') elseif exists('*quickfixsigns#vcsdiff#GetHunkSummary')
let s:source_func = 'quickfixsigns#vcsdiff#GetHunkSummary' let b:source_func = 'quickfixsigns#vcsdiff#GetHunkSummary'
else else
let s:source_func = 's:get_hunks_empty' let b:source_func = 's:get_hunks_empty'
endif endif
endif endif
return {s:source_func}() return {b:source_func}()
endfunction endfunction
function! airline#extensions#hunks#get_hunks() function! airline#extensions#hunks#get_hunks()