How to get the func prototype after selecting the func via omnicppcomplete?

1.2k Views Asked by At

Is there a way to get vim to paste a function's arguments after selecting it via omnifunc (or at least displaying it after selecting it, but not before)? Something like:

myObject.play(int time, std::string foo)

Maybe even allows you to tab through the arguments like what those snippets plugins allow you to do.

Is there such a plugin or feature? I think this is extremely useful.

BTW, omnifunc's preview option is very slow and will not show up after you select a function.

2

There are 2 best solutions below

3
On

you could get the snippetsEMU plugin from the vim website then set up a custom snippet for that function like this:

:Snippet play myObject.play(int <{time}>, <{std::string}> <{foo}>)<{}>
This way all you have to do is type play and hit the tab key to have it expanded the curly braces will allow you to tab through the the args. Hope this is what you're looking for...

0
On

Try code_complete.

It uses ctags to complete a function signature and allows you to cycle through the arguments list. It can complete other stuff as well - standard header files, for()/switch() blocks etc.