Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

You know how we can get information about the current file with Ctrl+g. I would like to extend that to show the current function name the cursor is currently in. Assume C language.

Any Vim pros out there to help me out?

share|improve this question
    
You would like it to show the name of the function you're currently "in"? Or? –  ldigas Oct 14 '11 at 18:48
    
vim mailing lists & irc is a better place to ask, I would say. –  shadyabhi Oct 14 '11 at 19:15
    
@Idigas, yes, the function cursor is in, currently. –  slowpoison Oct 14 '11 at 19:24
add comment

1 Answer

You must really have large functions.

I see two ways to do that:

  1. by folding with the cursor on a blank line, it will fold the entire current function, letting you see its name. za to fold, look at the name, za to unfold.

  2. by using either TagList or TagBar, invoking either of these plugins will create a split window with an outline of your file and the cursor positioned on the current function's name and the name highlighted. If your cursor is on a member's name it will show the member instead so you may have to move your cursor over a keyword like int or on some whitespace.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.