vimagit: let vimagit itself returns the current mode

If current vimagit version does not provide vimagit#get_current_mode(),
internal string version is kept.
This commit is contained in:
Jerome Reybert 2017-11-20 13:47:48 +01:00
parent 4a1f65841c
commit 640d6762f7

View File

@ -13,14 +13,18 @@ function! airline#extensions#vimagit#init(ext)
endfunction endfunction
function! airline#extensions#vimagit#get_mode() function! airline#extensions#vimagit#get_mode()
if ( b:magit_current_commit_mode == '' ) if ( exists("*magit#get_current_mode") )
return "STAGING" return magit#get_current_mode()
elseif ( b:magit_current_commit_mode == 'CC' ) else
return "COMMIT" if ( b:magit_current_commit_mode == '' )
elseif ( b:magit_current_commit_mode == 'CA' ) return "STAGING"
return "AMEND" elseif ( b:magit_current_commit_mode == 'CC' )
else return "COMMIT"
return "???" elseif ( b:magit_current_commit_mode == 'CA' )
return "AMEND"
else
return "???"
endif
endfunction endfunction
function! airline#extensions#vimagit#apply(...) function! airline#extensions#vimagit#apply(...)