From fc09bf751aa04b7daaac555ab1e36ef0898599ae Mon Sep 17 00:00:00 2001 From: kazukazuinaina Date: Thu, 13 Feb 2020 09:08:20 +0900 Subject: [PATCH] [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 --- autoload/airline/extensions.vim | 16 +++++----------- autoload/airline/extensions/gina.vim | 20 ++++++++++++++++++++ doc/airline.txt | 2 +- 3 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 autoload/airline/extensions/gina.vim diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 50c1c161..6db4b739 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -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 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') diff --git a/autoload/airline/extensions/gina.vim b/autoload/airline/extensions/gina.vim new file mode 100644 index 00000000..d9059f4e --- /dev/null +++ b/autoload/airline/extensions/gina.vim @@ -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 diff --git a/doc/airline.txt b/doc/airline.txt index f9442e9c..d2703511 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -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*