Merge pull request #1375 from jreybert/master

Add vimagit extension to display current mode
This commit is contained in:
Christian Brabandt 2017-01-19 15:09:00 +01:00 committed by GitHub
commit e7e4769dc1
4 changed files with 47 additions and 1 deletions

View File

@ -12,7 +12,7 @@ Lean & mean status/tabline for vim that's light as air.
[undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29], [undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29],
[vim-signify][30], [quickfixsigns][39], [syntastic][5], [eclim][34], [vim-signify][30], [quickfixsigns][39], [syntastic][5], [eclim][34],
[lawrencium][21], [virtualenv][31], [tmuxline][35], [taboo.vim][37], [lawrencium][21], [virtualenv][31], [tmuxline][35], [taboo.vim][37],
[ctrlspace][38], [vim-bufmru][47] and more. [ctrlspace][38], [vim-bufmru][47], [vimagit][50] and more.
* Looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols. * Looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols.
* Optimized for speed; it loads in under a millisecond. * Optimized for speed; it loads in under a millisecond.
* Extensive suite of themes for popular color schemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [base16][32] (all variants), [molokai][25], [jellybeans][26] and others. * Extensive suite of themes for popular color schemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [base16][32] (all variants), [molokai][25], [jellybeans][26] and others.
@ -84,6 +84,9 @@ vim-airline integrates with a variety of plugins out of the box. These extensio
#### hunks ([vim-gitgutter][29] & [vim-signify][30]) #### hunks ([vim-gitgutter][29] & [vim-signify][30])
![image](https://f.cloud.github.com/assets/306502/995185/73fc7054-09b9-11e3-9d45-618406c6ed98.png) ![image](https://f.cloud.github.com/assets/306502/995185/73fc7054-09b9-11e3-9d45-618406c6ed98.png)
#### [vimagit][50]
![vim-airline-vimagit-demo](https://cloud.githubusercontent.com/assets/533068/22107273/2ea85ba0-de4d-11e6-9fa8-331103b88df4.gif)
#### [virtualenv][31] #### [virtualenv][31]
![image](https://f.cloud.github.com/assets/390964/1022566/cf81f830-0d98-11e3-904f-cf4fe3ce201e.png) ![image](https://f.cloud.github.com/assets/390964/1022566/cf81f830-0d98-11e3-904f-cf4fe3ce201e.png)
@ -248,3 +251,4 @@ MIT License. Copyright (c) 2013-2016 Bailey Ling.
[47]: https://github.com/mildred/vim-bufmru [47]: https://github.com/mildred/vim-bufmru
[48]: https://github.com/ierton/xkb-switch [48]: https://github.com/ierton/xkb-switch
[49]: https://github.com/vovkasm/input-source-switcher [49]: https://github.com/vovkasm/input-source-switcher
[50]: https://github.com/jreybert/vimagit

View File

@ -183,6 +183,12 @@ function! airline#extensions#load()
call add(loaded_ext, 'hunks') call add(loaded_ext, 'hunks')
endif endif
if get(g:, 'airline#extensions#vimagit#enabled', 1)
\ && (exists('g:loaded_magit'))
call airline#extensions#vimagit#init(s:ext)
call add(loaded_ext, 'vimagit')
endif
if get(g:, 'airline#extensions#tagbar#enabled', 1) if get(g:, 'airline#extensions#tagbar#enabled', 1)
\ && exists(':TagbarToggle') \ && exists(':TagbarToggle')
call airline#extensions#tagbar#init(s:ext) call airline#extensions#tagbar#init(s:ext)

View File

@ -0,0 +1,30 @@
" 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

View File

@ -420,6 +420,12 @@ quickfixsigns <https://github.com/tomtom/quickfixsigns_vim>
* set hunk count symbols. > * set hunk count symbols. >
let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-'] let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-']
< <
------------------------------------- *airline-vimagit*
vimagit <https://github.com/jreybert/vimagit>
* enable/disable vimagit integration >
let g:airline#extensions#vimagit#enabled = 1
<
------------------------------------- *airline-ctrlp* ------------------------------------- *airline-ctrlp*
ctrlp <https://github.com/kien/ctrlp.vim> ctrlp <https://github.com/kien/ctrlp.vim>