8

I've been using Vim for quite a while now, and while the code-completion (omni, dictionary, etc) works fine I've been missing one thing.

Syntax-hinting, so basically I'd like to know what arguments a function accepts, rather than look it up online I'd like to have it somewhere in Vim, preferably in a box above the current line or something.

Is there any way to achieve this, I mostly work with PHP, Python and C++ so I need it for those languages.

Edit: I do already have ctags installed, but from what I could tell it didn't provide syntax-hinting, tried it with PHP standard functions, dunno if I've overlooked something.

There's also the option of using snipMate and entering all standard library functions, but that's a lot of work, would've imagined that someone already did that (And yes there's something like ultiSnips that does but it's inferior to snipMate)

3
  • You could have a look at ctags. I haven't explored it myself, but I keep meaning to. I know that it is supposed to allow completion of struct members, and suchlike. Not sure if it can do function arguments though. May 11, 2011 at 11:49
  • @Goulash Yeah I've already installed that, and while it does provide completion it doesn't seem to provide syntax hinting. May 11, 2011 at 12:15
  • 2
    I don't know for Python and C++ but in PHP, <C-x><C-o> brings both a contextual menu with possible completions and a little window with the "prototype" of the method, including arg names and types.
    – romainl
    May 11, 2011 at 12:29

2 Answers 2

7

From the way it sounds I think you are looking for set completeopt+=preview. More information can be found at :help completeopt.

2

I think the plugin echofunc does that. When you are writing code, after you press ( the function prototype is displayed in the statusbar.

Check also the plugin srcexpl.vim which I think does something similar (I don't use it much though).

2
  • Thanks for the tips, and it seems it does do what I want it to do, but there's 1 problem, which is ctags related, how do I get it to also show built-in/module functions from PHP/Python rather than just my own code? May 13, 2011 at 16:31
  • I don't know how exactly how to do that. I think you might want to ask a separate question for that.
    – skeept
    May 15, 2011 at 1:18

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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