From 44a3d2ee56082ac5b0833facd59ca9e11c9f0b1a Mon Sep 17 00:00:00 2001 From: Jerome Reybert <jreybert@gmail.com> Date: Mon, 20 Nov 2017 13:52:16 +0100 Subject: [PATCH] Add magit#get_current_mode API function It returns a string of the current vimagit mode. It is used for example by vim-airline vimagit extension. It seems a good idea that vimagit itself returns the string. See vim-airline/vim-airline#1602 --- plugin/magit.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugin/magit.vim b/plugin/magit.vim index 879dca3..3437d84 100644 --- a/plugin/magit.vim +++ b/plugin/magit.vim @@ -1249,6 +1249,16 @@ function! magit#show_version() \ g:vimagit_version[2] endfunction +function! magit#get_current_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" + endif +endfunction + command! Magit call magit#show_magit('v') command! MagitOnly call magit#show_magit('c') -- GitLab