diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 30e733e..3b36ba9 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -307,6 +307,11 @@ function! airline#extensions#load() call add(loaded_ext, 'capslock') endif + if (get(g:, 'airline#extensions#gutentags#enabled', 1) && get(g:, 'loaded_gutentags', 0)) + call airline#extensions#gutentags#init(s:ext) + call add(loaded_ext, 'gutentags') + endif + if (get(g:, 'airline#extensions#xkblayout#enabled', 1) && exists('g:XkbSwitchLib')) call airline#extensions#xkblayout#init(s:ext) call add(loaded_ext, 'xkblayout') diff --git a/autoload/airline/extensions/gutentags.vim b/autoload/airline/extensions/gutentags.vim new file mode 100644 index 0000000..1da48a5 --- /dev/null +++ b/autoload/airline/extensions/gutentags.vim @@ -0,0 +1,16 @@ +" MIT License. Copyright (c) 2014-2018 Mathias Andersson et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'loaded_gutentags', 0) + finish +endif + +function! airline#extensions#gutentags#status() + return gutentags#statusline() =~# '^TAGS' ? 'Gen. tags' : '' +endfunction + +function! airline#extensions#gutentags#init(ext) + call airline#parts#define_function('gutentags', 'airline#extensions#gutentags#status') +endfunction diff --git a/autoload/airline/init.vim b/autoload/airline/init.vim index 228d012..cc00950 100644 --- a/autoload/airline/init.vim +++ b/autoload/airline/init.vim @@ -149,6 +149,7 @@ function! airline#init#bootstrap() \ 'ycm_error_count', 'ycm_warning_count', 'neomake_error_count', \ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count']) call airline#parts#define_text('capslock', '') + call airline#parts#define_text('gutentags', '') call airline#parts#define_text('xkblayout', '') call airline#parts#define_text('keymap', '') @@ -180,7 +181,7 @@ function! airline#init#sections() let g:airline_section_gutter = airline#section#create(['%=']) endif if !exists('g:airline_section_x') - let g:airline_section_x = airline#section#create_right(['tagbar', 'filetype']) + let g:airline_section_x = airline#section#create_right(['tagbar', 'gutentags', 'filetype']) endif if !exists('g:airline_section_y') let g:airline_section_y = airline#section#create_right(['ffenc']) diff --git a/doc/airline.txt b/doc/airline.txt index c0ac19b..ad6ce40 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -885,6 +885,12 @@ NrrwRgn * enable/disable NrrwRgn integration > let g:airline#extensions#nrrwrgn#enabled = 1 +------------------------------------- *airline-gutentags* +vim-gutentags + +* enable/disable vim-gutentags integration > + let g:airline#extensions#gutentags#enabled = 1 + ------------------------------------- *airline-capslock* vim-capslock diff --git a/t/init.vim b/t/init.vim index da795d4..9fb21e8 100644 --- a/t/init.vim +++ b/t/init.vim @@ -34,7 +34,7 @@ describe 'init sections' end it 'section x should be filetype' - Expect g:airline_section_x == '%{airline#util#wrap(airline#parts#filetype(),0)}' + Expect g:airline_section_x == '%{airline#util#prepend(\"\",0)}%{airline#util#wrap(airline#parts#filetype(),0)}' end it 'section y should be fenc and ff'