Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Most editors have a feature like when you press some keys by placing caret over a function, it pops the documentation of that function along with number and type of arguments that function takes.

I was wondering whether Vim offers such support. For example, while coding in C, I use a built in function qsort(). Since I am not sure about type and number of arguments it takes, I would like to know it without escaping Vim. Is it possible?

share|improve this question
Not sure this is exactly what you want, but if you give the right value to the option 'keywordprg' (the name of a program which can handle the documentation for the language you want), then by hitting K on a keyword (which can be the name of a function), you should get the info you want. For example, if you install cppman ( and add an autocmd inside your vimrc such as autocmd FileType cpp setlocal keywordprg=cppman, then cppman should handle the documentation inside a c++ buffer. Not tested though. – saginaw Jan 23 at 18:33
@saginaw While cppman is an excellent suggestion, if you have the C and C++ manpages (manpages-posix-dev and libstdc++-X.Y-doc packages on Debian-based systems) installed, plain old man should work. – muru Jan 23 at 23:53

If you want proper documentation, the plugin in saginaw's comment seems to cover your C++ needs. I don't know of a generic one but you can probably find alternatives for other languages on


  • your code is already indexed with ctags,
  • your index also includes the standard library,
  • and all you want is a hint,

you can use <C-w>} to open the definition of the keyword under your cursor in a preview window. YMMV, of course.

See :help preview-window, :help tags and :help ctags.

You can also use Vim's built-in "include-search" functionality: press [i to print the "signature" of the word under the cursor in the command-line:


See :help include-search.

share|improve this answer
[i is weird. It works for stdlib.h and qsort, but not cstdlib and std::qsort or just qsort. – muru Jan 23 at 20:25

If you can set up YouCompleteMe, it supports C, C++, JavaScript, Go and some other languages. Here's it in action:

enter image description here enter image description here

It's a bit annoying to install, and once it's installed you need to configure it for C and C++ by creating a I lifted one from this repo, and got this effect.

share|improve this answer
"t's a bit annoying to install,"... That's an understatement. Still, it is very good. ^_~ – Sardathrion Jan 28 at 9:27
Is there any way to force the completions pop-up to remain opened while the function arguments are typed? For example, as soon as you type the first letter of the first argument qsort(a, the pop-up window disappears, making it difficult to remember the next arguments. – thiagowfx Jun 28 at 21:02

For C, pressing K on the keyword will pull up the built-in manpage directly. For instance, place the cursor on the printf keyword:

printf("Hello, %s!", foo);

Now press K (upper case K) and the manpage for printf should appear in VIM:

   printf - format and print data

   printf FORMAT [ARGUMENT]...
   printf OPTION

   Print ARGUMENT(s) according to FORMAT, or execute according to OPTION:

   --help display this help and exit

          output version information and exit

   FORMAT controls the output as in C printf.  Interpreted sequences are:

   \"     double quote
   \\     backslash

   ... It continues for quite a few scrollable pages

This seems to work out of the box in all Debian-derived distros that I've tried it on, no specific configuration required.

share|improve this answer
That's the manpage of printf(1) the command, not printf(3) the function. In any case, the C function manpages are from manpages-dev, which is usually installed by default, but not always, and POSIX functions are in manpages-posix-dev - usually not installed by default, neither is C++ documentation (libstdc++-X.Y-doc). – muru Jan 24 at 9:24

Vim's C/C++ file type comes with a decent omnicompletion function, which supports "preview" functionality. So add "preview" to your completeopt option and see a function signature when you do insert mode completion.

In normal mode, you could CTRL+W } to open the function declaration in the preview window manually.

share|improve this answer

Your Answer


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.