From 89a2b67f2427d961bb2f0de771a0290d85e379f9 Mon Sep 17 00:00:00 2001 From: xero Date: Mon, 5 May 2014 15:09:26 -0400 Subject: add vim configs -- yes i have joined the cult of vim --- .../autoload/airline/extensions/tagbar.vim | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .vim/bundle/vim-airline/autoload/airline/extensions/tagbar.vim (limited to '.vim/bundle/vim-airline/autoload/airline/extensions/tagbar.vim') diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/tagbar.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/tagbar.vim new file mode 100644 index 0000000..56919a8 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/tagbar.vim @@ -0,0 +1,45 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !exists(':TagbarToggle') + finish +endif + +let s:flags = get(g:, 'airline#extensions#tagbar#flags', '') +let s:spc = g:airline_symbols.space + +" 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:airline_tagbar_last_lookup_time != localtime() + 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.1