1
0
Fork 0
mirror of synced 2024-06-01 15:01:10 -04:00
ultimate-vim/sources_non_forked/vim-airline/autoload/airline/extensions/tagbar.vim
amix 0d8e7370bd Added vim-commentary and updarted the plugins.
commentary:
Comment stuff out.  Use `gcc` to comment out a line (takes a count),
`gc` to comment out the target of a motion (for example, `gcap` to
comment out a paragraph), and `gc` in visual mode to comment out the
selection.  That's it.
2014-03-02 14:35:00 +00:00

46 lines
1.4 KiB
VimL

" 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