From 28dcb68bf3d1ac42e5fba351dd4d2aa8029c69a0 Mon Sep 17 00:00:00 2001 From: shmaryar Date: Mon, 1 Jul 2019 09:18:33 +0300 Subject: [PATCH] Add vista.vim (https://github.com/liuchengxu/vista.vim) integration --- autoload/airline/extensions.vim | 5 +++++ autoload/airline/extensions/vista.vim | 14 ++++++++++++++ autoload/airline/init.vim | 4 ++-- doc/airline.txt | 6 ++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 autoload/airline/extensions/vista.vim diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 112abf81..c594497a 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -213,6 +213,11 @@ function! airline#extensions#load() call add(s:loaded_ext, 'tagbar') endif + if get(g:, 'airline#extensions#vista#enabled', 1) + call airline#extensions#vista#init(s:ext) + call add(s:loaded_ext, 'vista') + endif + if get(g:, 'airline#extensions#bookmark#enabled', 1) \ && exists(':BookmarkToggle') call airline#extensions#bookmark#init(s:ext) diff --git a/autoload/airline/extensions/vista.vim b/autoload/airline/extensions/vista.vim new file mode 100644 index 00000000..a62bb548 --- /dev/null +++ b/autoload/airline/extensions/vista.vim @@ -0,0 +1,14 @@ +" MIT License. Copyright (c) 2019 s1341 (github@shmarya.net) +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +function! airline#extensions#vista#currenttag() + if get(w:, 'airline_active', 0) + return get(b:, 'vista_nearest_method_or_function', '') + endif +endfunction + +function! airline#extensions#vista#init(ext) + call airline#parts#define_function('vista', 'airline#extensions#vista#currenttag') +endfunction diff --git a/autoload/airline/init.vim b/autoload/airline/init.vim index 1a684892..18d22ceb 100644 --- a/autoload/airline/init.vim +++ b/autoload/airline/init.vim @@ -166,7 +166,7 @@ function! airline#init#bootstrap() \ 'ycm_error_count', 'ycm_warning_count', 'neomake_error_count', \ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count', \ 'languageclient_error_count', 'languageclient_warning_count', - \ 'coc_warning_count', 'coc_error_count']) + \ 'coc_warning_count', 'coc_error_count', 'vista']) call airline#parts#define_text('bookmark', '') call airline#parts#define_text('capslock', '') call airline#parts#define_text('gutentags', '') @@ -200,7 +200,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(['bookmark', 'tagbar', 'gutentags', 'grepper', 'filetype']) + let g:airline_section_x = airline#section#create_right(['bookmark', 'tagbar', 'vista', 'gutentags', 'grepper', '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 00977920..83ad514e 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -1167,6 +1167,12 @@ virtualenv * enable/disable virtualenv integration > let g:airline#extensions#virtualenv#enabled = 1 < +------------------------------------- *airline-vista* +vista.vim + +* enable/disable vista integration > + let g:airline#extensions#vista#enabled = 1 + ------------------------------------- *airline-whitespace* * enable/disable detection of whitespace errors. > let g:airline#extensions#whitespace#enabled = 1