From 640d6762f7172112c699548a6c458420ac01c62b Mon Sep 17 00:00:00 2001 From: Jerome Reybert Date: Mon, 20 Nov 2017 13:47:48 +0100 Subject: [PATCH] vimagit: let vimagit itself returns the current mode If current vimagit version does not provide vimagit#get_current_mode(), internal string version is kept. --- autoload/airline/extensions/vimagit.vim | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/autoload/airline/extensions/vimagit.vim b/autoload/airline/extensions/vimagit.vim index 400792e..814c1db 100644 --- a/autoload/airline/extensions/vimagit.vim +++ b/autoload/airline/extensions/vimagit.vim @@ -13,14 +13,18 @@ function! airline#extensions#vimagit#init(ext) endfunction function! airline#extensions#vimagit#get_mode() - 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 "???" + 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 endfunction function! airline#extensions#vimagit#apply(...)