[Refactor] Functionalization of branch extension
This commit is contained in:
parent
c01977d027
commit
f107396118
|
@ -86,19 +86,27 @@ let s:sha1size = get(g:, 'airline#extensions#branch#sha1_len', 7)
|
|||
|
||||
function! s:update_git_branch()
|
||||
call airline#util#ignore_next_focusgain()
|
||||
if !airline#util#has_fugitive() && !airline#util#has_gina()
|
||||
if airline#util#has_fugitive()
|
||||
call s:config_fugitive_branch()
|
||||
elseif airline#util#has_gina()
|
||||
call s:config_gina_branch()
|
||||
else
|
||||
let s:vcs_config['git'].branch = ''
|
||||
return
|
||||
endif
|
||||
if airline#util#has_fugitive()
|
||||
let s:vcs_config['git'].branch = exists("*FugitiveHead") ?
|
||||
endfunction
|
||||
|
||||
function! s:config_fugitive_branch() abort
|
||||
let s:vcs_config['git'].branch = exists('*FugitiveHead') ?
|
||||
\ FugitiveHead(s:sha1size) : fugitive#head(s:sha1size)
|
||||
if s:vcs_config['git'].branch is# 'master' &&
|
||||
\ airline#util#winwidth() < 81
|
||||
" Shorten default a bit
|
||||
let s:vcs_config['git'].branch='mas'
|
||||
endif
|
||||
else
|
||||
endfunction
|
||||
|
||||
function! s:config_gina_branch() abort
|
||||
try
|
||||
let g:gina#component#repo#commit_length = s:sha1size
|
||||
let s:vcs_config['git'].branch = gina#component#repo#branch()
|
||||
|
@ -109,7 +117,6 @@ function! s:update_git_branch()
|
|||
" Shorten default a bit
|
||||
let s:vcs_config['git'].branch='mas'
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:display_git_branch()
|
||||
|
|
Loading…
Reference in New Issue