mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-25 23:14:50 +02:00
remove hackfix and use new tagbar statusline integration.
requires 0b14e28719
This commit is contained in:
parent
0e6035f75c
commit
c98549913c
@ -1,31 +1,26 @@
|
|||||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||||
" vim: et ts=2 sts=2 sw=2
|
" vim: et ts=2 sts=2 sw=2
|
||||||
|
|
||||||
function! airline#extensions#tagbar#apply(...)
|
" Arguments: current, sort, fname
|
||||||
if &ft == 'tagbar'
|
function! airline#extensions#tagbar#get_status(...)
|
||||||
call airline#extensions#apply_left_override('Tagbar', '%{TagbarGenerateStatusline()}')
|
let builder = airline#builder#new({ 'active': a:1 })
|
||||||
endif
|
call builder.add_section('airline_a', ' Tagbar ')
|
||||||
|
call builder.add_section('airline_b', ' '.a:2.' ')
|
||||||
|
call builder.add_section('airline_c', ' '.a:3.' ')
|
||||||
|
return builder.build()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:check_statusline()
|
function! airline#extensions#tagbar#inactive_apply(...)
|
||||||
" this is a hack!! unlike most plugins that set eventignore=all, tagbar only
|
if getwinvar(a:2.winnr, '&filetype') == 'tagbar'
|
||||||
" sets it to BufEnter, so the ordering is off: airline sets the statusline
|
return -1
|
||||||
" first, and then tagbar overwrites it, so this detects that and changes it
|
|
||||||
" back to the airline statusline.
|
|
||||||
if exists('#airline') && match(&statusline, '^%!Tagbar') >= 0
|
|
||||||
call airline#update_statusline()
|
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#tagbar#init(ext)
|
function! airline#extensions#tagbar#init(ext)
|
||||||
call a:ext.add_statusline_func('airline#extensions#tagbar#apply')
|
call a:ext.add_inactive_statusline_func('airline#extensions#tagbar#inactive_apply')
|
||||||
|
let g:tagbar_status_func = 'airline#extensions#tagbar#get_status'
|
||||||
|
|
||||||
let g:airline_section_x = '%(%{get(w:,"airline_active",0) ? tagbar#currenttag("%s","") : ""} '
|
let g:airline_section_x = '%(%{get(w:,"airline_active",0) ? tagbar#currenttag("%s","") : ""} '
|
||||||
\ .g:airline_right_alt_sep.' %)'.g:airline_section_x
|
\ .g:airline_right_alt_sep.' %)'.g:airline_section_x
|
||||||
|
|
||||||
augroup airline_tagbar
|
|
||||||
autocmd!
|
|
||||||
autocmd CursorMoved * call <sid>check_statusline()
|
|
||||||
augroup END
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user