Customize airline tagbar extension to include current tags parent
Asked Answered
N

1

3

The airline plugin has an extension which uses Tagbar to show the current function name.

(I know this because of this question which I found via asking this question)

This works really well and looks great. Here's airline showing me I'm editing the do_foo() function: airline tagbar extension and the do_foo() function

But Tagbar knows much more than this! Specifically, it knows the current class (i.e. the parent of the current tag):

Tagbar and the DoesFoo class

(It does this using ctags)

Is there a way to configure airline to tell me the current class as well as the current function?

Novick answered 18/11, 2015 at 18:9 Comment(3)
Do you mean something like let g:airline#extensions#tagbar#flags = 'f' (it displays the full hierarchy of the tag, not just the tag itself)?Buck
@Buck That's it!! Exactly what I've been looking for! Where is the documentation for this?Novick
You can find it in vim-airline doc. The explanation of flags is in tagbar doc. If you have the plugins installed properly, you can get to it in Vim with :h airline-tagbar, and :h tagbar-statusline.Buck
B
1

Full start-to-finish process:

Install universal-ctags: apt-get install universal-ctags or alternative Add these lines in your init.vim / .vimrc, doing an update with your package manager.

Plug 'vim-airline/vim-airline'
Plug 'preservim/tagbar'
...
let g:airline#extensions#tagbar#enabled = 1                                                                                                                                                                   
let g:airline#extensions#tagbar#flags = 'f' 
Bullfinch answered 15/3 at 11:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.