2019-03-25 11:27:10 +00:00
|
|
|
" MIT License. Copyright (c) 2016-2019 Jerome Reybert et al.
|
2019-11-08 19:18:04 +00:00
|
|
|
" Plugin: https://github.com/jreybert/vimagit
|
2017-01-19 12:57:36 +00:00
|
|
|
" vim: et ts=2 sts=2 sw=2
|
|
|
|
|
2019-03-25 11:27:10 +00:00
|
|
|
" This plugin replaces the whole section_a when in vimagit buffer
|
2017-01-19 12:57:36 +00:00
|
|
|
scriptencoding utf-8
|
|
|
|
|
|
|
|
if !get(g:, 'loaded_magit', 0)
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
|
|
|
function! airline#extensions#vimagit#init(ext)
|
|
|
|
call a:ext.add_statusline_func('airline#extensions#vimagit#apply')
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! airline#extensions#vimagit#get_mode()
|
2017-11-20 12:47:48 +00:00
|
|
|
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
|
2017-01-19 12:57:36 +00:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! airline#extensions#vimagit#apply(...)
|
|
|
|
if ( &filetype == 'magit' )
|
|
|
|
let w:airline_section_a = '%{airline#extensions#vimagit#get_mode()}'
|
|
|
|
endif
|
|
|
|
endfunction
|