[refactor] vimagit's extension

This commit is contained in:
kazukazuinaina 2020-05-21 15:19:25 +09:00
parent f244ff9987
commit a133605d01
1 changed files with 3 additions and 9 deletions

View File

@ -9,6 +9,8 @@ if !get(g:, 'loaded_magit', 0)
finish
endif
let s:commit_mode = {'': 'STAGING', 'CC': 'COMMIT', 'CA': 'AMEND'}
function! airline#extensions#vimagit#init(ext) abort
call a:ext.add_statusline_func('airline#extensions#vimagit#apply')
endfunction
@ -17,15 +19,7 @@ function! airline#extensions#vimagit#get_mode() abort
if ( exists("*magit#get_current_mode") )
return magit#get_current_mode()
else
if ( b:magit_current_commit_mode == '' )
return "STAGING"
elseif ( b:magit_current_commit_mode == 'CC' )
return "COMMIT"
elseif ( b:magit_current_commit_mode == 'CA' )
return "AMEND"
else
return "???"
endif
return get(s:commit_mode, b:magit_current_commit_mode, '???')
endif
endfunction