Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show in what method and class I'm in #42

Closed
daGrevis opened this issue Oct 7, 2013 · 6 comments
Closed

Show in what method and class I'm in #42

daGrevis opened this issue Oct 7, 2013 · 6 comments

Comments

@daGrevis
Copy link

daGrevis commented Oct 7, 2013

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? :)

@itchyny
Copy link
Owner

itchyny commented Oct 7, 2013

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

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

@daGrevis
Copy link
Author

daGrevis commented Oct 7, 2013

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

preview

@itchyny
Copy link
Owner

itchyny commented Oct 7, 2013

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

@daGrevis
Copy link
Author

daGrevis commented Oct 7, 2013

Great, it works! :)

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

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

@daGrevis daGrevis closed this as completed Oct 7, 2013
@kkanungo17
Copy link

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?

@itchyny
Copy link
Owner

itchyny commented Dec 2, 2018

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants