[update] gina's extensions in extensions dir

fix typo and add section_b

[add] extension gina

[add] unstaged extensions

[fix] typo

[Done] gina refactoring

[fix] document

[fix] gina's spell

[add] abort
This commit is contained in:
kazukazuinaina 2020-02-13 09:08:20 +09:00
parent 099dd92eeb
commit fc09bf751a
3 changed files with 26 additions and 12 deletions

View File

@ -35,17 +35,6 @@ let s:filetype_overrides = {
\ 'vaffle' : [ 'Vaffle', '' ],
\ }
if airline#util#has_gina() && get(g:, 'airline#extensions#gina_status', 1)
" Gina needs the Vim 7.4.1898, which introduce the <mods> flag for custom commands
let s:filetype_overrides['gina-status'] = ['gina', '%{gina#component#repo#preset()}' ]
let s:filetype_overrides['diff'] = ['gina', '%{gina#component#repo#preset()}' ]
let s:filetype_overrides['gina-log'] = ['gina', '%{gina#component#repo#preset()}' ]
let s:filetype_overrides['gina-tag'] = ['gina', '%{gina#component#repo#preset()}' ]
let s:filetype_overrides['gina-branch'] = ['gina', '%{gina#component#repo#branch()}' ]
let s:filetype_overrides['gina-reflog'] = ['gina', '%{gina#component#repo#branch()}' ]
let s:filetype_overrides['gina-ls'] = ['gina', '%{gina#component#repo#branch()}' ]
endif
if get(g:, 'airline#extensions#nerdtree_statusline', 1)
let s:filetype_overrides['nerdtree'] = [ get(g:, 'NERDTreeStatusline', 'NERD'), '' ]
else
@ -171,6 +160,11 @@ function! airline#extensions#load()
call add(s:loaded_ext, 'denite')
endif
if get(g:, 'loaded_gina', 0) && get(g:, 'airline#extensions#gina#enabled', 1)
call airline#extensions#gina#init(s:ext)
call add(s:loaded_ext, 'gina')
endif
if exists(':NetrwSettings')
call airline#extensions#netrw#init(s:ext)
call add(s:loaded_ext, 'netrw')

View File

@ -0,0 +1,20 @@
scriptencoding utf-8
if !get(g:, 'loaded_gina', 0)
finish
endif
function! airline#extensions#gina#apply(...) abort
if (&ft =~# 'gina' && &ft !~# 'blame') || &ft ==# 'diff'
call a:1.add_section('airline_a', ' gina ')
call a:1.add_section('airline_b', ' %{gina#component#repo#branch()} ')
call a:1.split()
call a:1.add_section('airline_y', ' staged %{gina#component#status#staged()} ')
call a:1.add_section('airline_z', ' unstaged %{gina#component#status#unstaged()} ')
return 1
endif
endfunction
function! airline#extensions#gina#init(ext) abort
let g:gina_force_overwrite_statusline = 0
call a:ext.add_statusline_func('airline#extensions#gina#apply')
endfunction

View File

@ -715,7 +715,7 @@ Airline displays the gina.vim specific statusline.
(for details, see the help of gina.vim)
* enable/disable bufferline integration >
let g:airline#extensions#gina_status = 1
let g:airline#extensions#gina#enabled = 1
< default: 1
------------------------------------- *airline-grepper*