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

\ '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.
Most helpful comment
Great, it works! :)
Based on this reference, I changed it to show class as well.