Search code examples
vim

Show function name in status line


I edit a large C, C++, or Java file, say, about 15000 lines, with pretty long function definitions, say, about 400 lines. When the cursor is in middle of a function definition, it would be cool to see the function name in Vim status line.

When we set :set ls=2 in Vim, we can get the file path (relative to the current directory), line number, etc. It would be really cool if we could see the function name too. Any ideas how to get it?

Currently I use [[ to go to start of the function and Ctrl-O to get back to the line I'm editing.


Solution

  • You can use ctags.vim for this, it will show the current function name in the title or status bar.

    SOURCE: https://superuser.com/questions/279651/how-can-i-make-vim-show-the-current-class-and-method-im-editing