Search code examples
pythonvimctagsvim-airlinetagbar

Customize airline tagbar extension to include current tags parent


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?


Solution

  • 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'