Lightline.vim: Show in what method and class I'm in

Created on 7 Oct 2013  路  6Comments  路  Source: itchyny/lightline.vim

It would be really cool if I could see in what method and class I'm in. It could use Ctags.

What do you think? :)

configuration

Most helpful comment

Great, it works! :)

Based on this reference, I changed it to show class as well.

      \ 'component': {
      \   'tagbar': '%{tagbar#currenttag("[%s]", "", "f")}',
      \ },

All 6 comments

You can use the tagbar plugin (https://github.com/majutsushi/tagbar).

let g:lightnline = {
        \ 'component': {
        \   'tagbar': '%{tagbar#currenttag("[%s]", "")}',
        \ },
        \ }

Thanks! How can I enable it thought? I added your snippet to my conf and I have lightline and tagbar installed.

preview

      \   'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ], ['ctrlpmark', 'tagbar'] ],

Great, it works! :)

Based on this reference, I changed it to show class as well.

      \ 'component': {
      \   'tagbar': '%{tagbar#currenttag("[%s]", "", "f")}',
      \ },

Sorry for reviving a closed thread, but the tag shown using the current solution persists even after the cursor has left the function and has not entered another function. Is there a way to fix this?

@kkanungo17 That's not a issue of lightline but tagbar. Please submit a issue to the tagbar repository. I recommend to describe the issue without lightline, with samlpe code and the results of :echo tagbar#currenttag("[%s]", "", "f"), line numbers and what you expect.

Was this page helpful?
0 / 5 - 0 ratings