From 7217c7749e5403c9c7856c1d12c7986eb9c3b460 Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Tue, 31 Mar 2020 17:52:49 +0300 Subject: Goodbye vim, been using neovim for ages now; home directory cleanup --- .../site/autoload/airline/extensions/tagbar.vim | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 dotfiles/.local/share/nvim/site/autoload/airline/extensions/tagbar.vim (limited to 'dotfiles/.local/share/nvim/site/autoload/airline/extensions/tagbar.vim') diff --git a/dotfiles/.local/share/nvim/site/autoload/airline/extensions/tagbar.vim b/dotfiles/.local/share/nvim/site/autoload/airline/extensions/tagbar.vim new file mode 100644 index 0000000..5db53ee --- /dev/null +++ b/dotfiles/.local/share/nvim/site/autoload/airline/extensions/tagbar.vim @@ -0,0 +1,58 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists(':TagbarToggle') + finish +endif + +let s:flags = get(g:, 'airline#extensions#tagbar#flags', '') +let s:spc = g:airline_symbols.space +let s:init=0 + +" Arguments: current, sort, fname +function! airline#extensions#tagbar#get_status(...) + let builder = airline#builder#new({ 'active': a:1 }) + call builder.add_section('airline_a', s:spc.'Tagbar'.s:spc) + call builder.add_section('airline_b', s:spc.a:2.s:spc) + call builder.add_section('airline_c', s:spc.a:3.s:spc) + return builder.build() +endfunction + +function! airline#extensions#tagbar#inactive_apply(...) + if getwinvar(a:2.winnr, '&filetype') == 'tagbar' + return -1 + endif +endfunction + +let s:airline_tagbar_last_lookup_time = 0 +let s:airline_tagbar_last_lookup_val = '' +function! airline#extensions#tagbar#currenttag() + if get(w:, 'airline_active', 0) + if !s:init + try + " try to load the plugin, if filetypes are disabled, + " this will cause an error, so try only once + let a=tagbar#currenttag('%', '', '') + catch + endtry + unlet! a + let s:init=1 + endif + " function tagbar#currenttag does not exist, if filetype is not enabled + if s:airline_tagbar_last_lookup_time != localtime() && exists("*tagbar#currenttag") + let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', s:flags) + let s:airline_tagbar_last_lookup_time = localtime() + endif + return s:airline_tagbar_last_lookup_val + endif + return '' +endfunction + +function! airline#extensions#tagbar#init(ext) + call a:ext.add_inactive_statusline_func('airline#extensions#tagbar#inactive_apply') + let g:tagbar_status_func = 'airline#extensions#tagbar#get_status' + + call airline#parts#define_function('tagbar', 'airline#extensions#tagbar#currenttag') +endfunction -- cgit v1.2.3