I spend 20% of my life writing code in vim, almost exclusively javascript and python. The other 80% of the time I am mostly scrolling up and down my source file, trying to remember which function I'm currently editing and what class the function belongs to.
This may be technically impossible for reasons I don't understand, but are there any vim plugins which allow the vim status line to show the function the cursor is currently in for Python and/or Javascript?
It would look like this:
It's possible this already exists in, say, SublimeText. If so, I might finally stop crying and make the switch.
Some Vim plugins which don't offer this functionality:
Since writing this question I've found ctags which does the same thing for C knows this kind of information. But how do I get it to display in the Vim status line?
You should try the Tagbar plugin, which is ctags based. If you check the screenshots on that link you will notice the status lines shows the name of the current method, exactly as you asked.
The plugin documentation explain how you could set your status line; the following is the configuration I'm using on my vimrc:
command! -nargs=0 TagbarToggleStatusline call TagbarToggleStatusline()
nnoremap <silent> <c-F12> :TagbarToggleStatusline<CR>
function! TagbarToggleStatusline()
let tStatusline = '%{exists(''*tagbar#currenttag'')?
\tagbar#currenttag('' [%s] '',''''):''''}'
if stridx(&statusline, tStatusline) != -1
let &statusline = substitute(&statusline, '\V'.tStatusline, '', '')
else
let &statusline = substitute(&statusline, '\ze%=%-', tStatusline, '')
endif
endfunction
As sometimes I work with very large source files, and swapping between large files causes a small delay due to ctags execution, I prefer to enable and disable this functionality by using the mapping (Ctrl+F12) or command defined above.