mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-21 13:04:54 +02:00
[refactor] vimagit's extension
This commit is contained in:
parent
f244ff9987
commit
a133605d01
@ -9,6 +9,8 @@ if !get(g:, 'loaded_magit', 0)
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let s:commit_mode = {'': 'STAGING', 'CC': 'COMMIT', 'CA': 'AMEND'}
|
||||||
|
|
||||||
function! airline#extensions#vimagit#init(ext) abort
|
function! airline#extensions#vimagit#init(ext) abort
|
||||||
call a:ext.add_statusline_func('airline#extensions#vimagit#apply')
|
call a:ext.add_statusline_func('airline#extensions#vimagit#apply')
|
||||||
endfunction
|
endfunction
|
||||||
@ -17,15 +19,7 @@ function! airline#extensions#vimagit#get_mode() abort
|
|||||||
if ( exists("*magit#get_current_mode") )
|
if ( exists("*magit#get_current_mode") )
|
||||||
return magit#get_current_mode()
|
return magit#get_current_mode()
|
||||||
else
|
else
|
||||||
if ( b:magit_current_commit_mode == '' )
|
return get(s:commit_mode, 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
|
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user