add gitgutter integration.
This commit is contained in:
parent
8f0401580b
commit
dad0d5a8d8
|
@ -7,7 +7,7 @@ Lean & mean statusline for vim that's light as air.
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
* tiny core written with extensibility in mind ([open/closed principle][8]).
|
* tiny core written with extensibility in mind ([open/closed principle][8]).
|
||||||
* integrates with a variety of plugins, including: [vim-bufferline][6], [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], [undotree][17], [nerdtree][18], [tagbar][19], [syntastic][5] and [lawrencium][21].
|
* integrates with a variety of plugins, including: [vim-bufferline][6], [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], [undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29], [syntastic][5] and [lawrencium][21].
|
||||||
* 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.
|
||||||
* fully customizable; if you know a little `statusline` syntax you can tweak it to your needs.
|
* fully customizable; if you know a little `statusline` syntax you can tweak it to your needs.
|
||||||
|
@ -135,3 +135,4 @@ MIT license. Copyright (c) 2013 Bailey Ling.
|
||||||
[26]: https://github.com/nanotech/jellybeans.vim
|
[26]: https://github.com/nanotech/jellybeans.vim
|
||||||
[27]: https://github.com/bling/vim-airline/wiki/FAQ
|
[27]: https://github.com/bling/vim-airline/wiki/FAQ
|
||||||
[28]: https://github.com/chrisbra/csv.vim
|
[28]: https://github.com/chrisbra/csv.vim
|
||||||
|
[29]: https://github.com/airblade/vim-gitgutter
|
||||||
|
|
|
@ -128,6 +128,10 @@ function! airline#extensions#load()
|
||||||
call airline#extensions#undotree#init(s:ext)
|
call airline#extensions#undotree#init(s:ext)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if g:airline_enable_hunks && exists('*GitGutterGetHunks')
|
||||||
|
call airline#extensions#hunks#init(s:ext)
|
||||||
|
endif
|
||||||
|
|
||||||
if g:airline_enable_tagbar && exists(':TagbarToggle')
|
if g:airline_enable_tagbar && exists(':TagbarToggle')
|
||||||
call airline#extensions#tagbar#init(s:ext)
|
call airline#extensions#tagbar#init(s:ext)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||||
|
" vim: et ts=2 sts=2 sw=2
|
||||||
|
|
||||||
|
function! airline#extensions#hunks#get_hunks()
|
||||||
|
try
|
||||||
|
" throws an error when first entering a buffer, so we gotta swallow it
|
||||||
|
silent! let hunks = GitGutterGetHunks()
|
||||||
|
let added = 0
|
||||||
|
let removed = 0
|
||||||
|
let changed = 0
|
||||||
|
for hunk in hunks
|
||||||
|
let diff = hunk[3] - hunk[1]
|
||||||
|
if diff > 0
|
||||||
|
let added += diff
|
||||||
|
elseif diff < 0
|
||||||
|
let removed -= diff
|
||||||
|
else
|
||||||
|
let changed += 1
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return printf('+%s ~%s -%s', added, changed, removed)
|
||||||
|
catch
|
||||||
|
return ''
|
||||||
|
endtry
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! airline#extensions#hunks#init(ext)
|
||||||
|
let g:airline_section_b .= '%{airline#extensions#hunks#get_hunks()} '
|
||||||
|
endfunction
|
||||||
|
|
|
@ -199,13 +199,19 @@ tagbar <https://github.com/majutsushi/>
|
||||||
*airline-csv*
|
*airline-csv*
|
||||||
csv.vim <https://github.com/chrisbra/csv.vim>
|
csv.vim <https://github.com/chrisbra/csv.vim>
|
||||||
|
|
||||||
* enable/disable csv integration for displaying the current column.
|
* enable/disable csv integration for displaying the current column. >
|
||||||
let g:airline_enable_csv = 1
|
let g:airline_enable_csv = 1
|
||||||
>
|
<
|
||||||
* change how columns are displayed. >
|
* change how columns are displayed. >
|
||||||
let g:airline#extensions#csv#column_display = 'Number' (default)
|
let g:airline#extensions#csv#column_display = 'Number' (default)
|
||||||
let g:airline#extensions#csv#column_display = 'Name'
|
let g:airline#extensions#csv#column_display = 'Name'
|
||||||
>
|
<
|
||||||
|
*airline-hunks*
|
||||||
|
vim-gitgutter <https://github.com/airblade/vim-gitgutter>
|
||||||
|
|
||||||
|
* enable/disable detecting changed hunks under source control. >
|
||||||
|
let g:airline_enable_hunks = 1
|
||||||
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
FUNCREFS *airline-funcrefs*
|
FUNCREFS *airline-funcrefs*
|
||||||
|
|
|
@ -21,6 +21,7 @@ call s:check_defined('g:airline_enable_branch', 1)
|
||||||
call s:check_defined('g:airline_enable_syntastic', 1)
|
call s:check_defined('g:airline_enable_syntastic', 1)
|
||||||
call s:check_defined('g:airline_enable_tagbar', 1)
|
call s:check_defined('g:airline_enable_tagbar', 1)
|
||||||
call s:check_defined('g:airline_enable_csv', 1)
|
call s:check_defined('g:airline_enable_csv', 1)
|
||||||
|
call s:check_defined('g:airline_enable_hunks', 1)
|
||||||
call s:check_defined('g:airline_detect_iminsert', 0)
|
call s:check_defined('g:airline_detect_iminsert', 0)
|
||||||
call s:check_defined('g:airline_detect_modified', 1)
|
call s:check_defined('g:airline_detect_modified', 1)
|
||||||
call s:check_defined('g:airline_detect_paste', 1)
|
call s:check_defined('g:airline_detect_paste', 1)
|
||||||
|
|
Loading…
Reference in New Issue