dotfiles/vim/plugins/vim-airline/autoload/airline/extensions/vimagit.vim

31 lines
784 B
VimL
Raw Normal View History

2018-04-05 13:06:54 +02:00
" MIT License. Copyright (c) 2016 Jerome Reybert
" vim: et ts=2 sts=2 sw=2
" This plugin replace the whole section_a when in vimagit buffer
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()
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 "???"
endfunction
function! airline#extensions#vimagit#apply(...)
if ( &filetype == 'magit' )
let w:airline_section_a = '%{airline#extensions#vimagit#get_mode()}'
endif
endfunction