Add gen_tags.vim plugin support

Display a "Gen. gen_tags" text in section x when gen_tags
is generating tags, similar to gutentags support.
This commit is contained in:
Kamil Cukrowski 2020-10-16 16:43:22 +02:00
parent 83bd08a97a
commit 42b31b966b
6 changed files with 34 additions and 2 deletions

View File

@ -17,6 +17,7 @@ This is the Changelog for the vim-airline project.
- [Vim-CMake](https://github.com/cdelledonne/vim-cmake) support - [Vim-CMake](https://github.com/cdelledonne/vim-cmake) support
- [battery.vim](https://github.com/lambdalisue/battery.vim) support - [battery.vim](https://github.com/lambdalisue/battery.vim) support
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) support - [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) support
- [gen_tags.vim](https://github.com/jsfaint/gen_tags.vim) support
- Improvements - Improvements
- git branch can also be displayed using [gina.vim](https://github.com/lambdalisue/gina.vim) - git branch can also be displayed using [gina.vim](https://github.com/lambdalisue/gina.vim)
- coc extensions can also show additional status messages - coc extensions can also show additional status messages

View File

@ -408,6 +408,11 @@ function! airline#extensions#load()
call add(s:loaded_ext, 'gutentags') call add(s:loaded_ext, 'gutentags')
endif endif
if get(g:, 'airline#extensions#gen_tags#enabled', 1) && (get(g:, 'loaded_gentags#gtags', 0) || get(g:, 'loaded_gentags#ctags', 0))
call airline#extensions#gen_tags#init(s:ext)
call add(s:loaded_ext, 'gen_tags')
endif
if (get(g:, 'airline#extensions#grepper#enabled', 1) && get(g:, 'loaded_grepper', 0)) if (get(g:, 'airline#extensions#grepper#enabled', 1) && get(g:, 'loaded_grepper', 0))
call airline#extensions#grepper#init(s:ext) call airline#extensions#grepper#init(s:ext)
call add(s:loaded_ext, 'grepper') call add(s:loaded_ext, 'grepper')

View File

@ -0,0 +1,19 @@
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
" Written by Kamil Cukrowski 2020
" Plugin: https://github.com/jsfaint/gen_tags.vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !(get(g:, 'loaded_gentags#gtags', 0) || !get(g:, 'loaded_gentags#ctags', 0))
finish
endif
function! airline#extensions#gen_tags#status(...) abort
return gen_tags#job#is_running() != 0 ? 'Gen. gen_tags' : ''
endfunction
function! airline#extensions#gen_tags#init(ext) abort
call airline#parts#define_function('gen_tags', 'airline#extensions#gen_tags#status')
endfunction

View File

@ -176,6 +176,7 @@ function! airline#init#bootstrap()
call airline#parts#define_text('bookmark', '') call airline#parts#define_text('bookmark', '')
call airline#parts#define_text('capslock', '') call airline#parts#define_text('capslock', '')
call airline#parts#define_text('gutentags', '') call airline#parts#define_text('gutentags', '')
call airline#parts#define_text('gen_tags', '')
call airline#parts#define_text('grepper', '') call airline#parts#define_text('grepper', '')
call airline#parts#define_text('xkblayout', '') call airline#parts#define_text('xkblayout', '')
call airline#parts#define_text('keymap', '') call airline#parts#define_text('keymap', '')
@ -211,7 +212,7 @@ function! airline#init#sections()
let g:airline_section_gutter = airline#section#create(['%=']) let g:airline_section_gutter = airline#section#create(['%='])
endif endif
if !exists('g:airline_section_x') if !exists('g:airline_section_x')
let g:airline_section_x = airline#section#create_right(['bookmark', 'tagbar', 'vista', 'gutentags', 'omnisharp', 'grepper', 'filetype']) let g:airline_section_x = airline#section#create_right(['bookmark', 'tagbar', 'vista', 'gutentags', 'gen_tags', 'omnisharp', 'grepper', 'filetype'])
endif endif
if !exists('g:airline_section_y') if !exists('g:airline_section_y')
let g:airline_section_y = airline#section#create_right(['ffenc']) let g:airline_section_y = airline#section#create_right(['ffenc'])

View File

@ -787,6 +787,12 @@ vim-gutentags <https://github.com/ludovicchabant/vim-gutentags>
* enable/disable vim-gutentags integration > * enable/disable vim-gutentags integration >
let g:airline#extensions#gutentags#enabled = 1 let g:airline#extensions#gutentags#enabled = 1
------------------------------------- *gen_tags.vim*
gen_tags.vim <https://github.com/jsfaint/gen_tags.vim>
* enable/disable gen_tags.vim integration >
let g:airline#extensions#gen_tags#enabled = 1
------------------------------------- *airline-hunks* ------------------------------------- *airline-hunks*
vim-gitgutter <https://github.com/airblade/vim-gitgutter> vim-gitgutter <https://github.com/airblade/vim-gitgutter>
vim-signify <https://github.com/mhinz/vim-signify> vim-signify <https://github.com/mhinz/vim-signify>

View File

@ -34,7 +34,7 @@ describe 'init sections'
end end
it 'section x should be filetype' it 'section x should be filetype'
Expect g:airline_section_x == '%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#wrap(airline#parts#filetype(),0)}' Expect g:airline_section_x == '%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#wrap(airline#parts#filetype(),0)}'
end end
it 'section y should be fenc and ff' it 'section y should be fenc and ff'