9

Is there a way to get argument completion for python?

I am currently using a combination of ctags, python-mode and YouCompleteMe, but I am missing a function to autocomplete the arguments of a function (or show them at least.)

Is there a Plugin that supports that?

I am using vim/gvim 7.4 and Ubuntu 14.04

10

By default, (with a minimal vimrc, and no plugins installed), this is already possible.

Vim ships with multiple filetype plugins and some of these plugins offer omni-completion right out of the box. For example, python comes with pythoncomplete.vim.

If you use the default pythoncomplete.vim that ships with Vim, (i.e. no YouCompleteMe, no python-mode, no jedi-vim), you get a preview window when you complete a function, that shows the keyword arguments.

All you need is Vim with +python feature (:echo has('python') shows 1). If you do, then this is all it takes to enable the default python omni-completion with your vimrc:

filetype plugin indent on

After hunting down many other completion solutions for python (jedi, python-mode), I've come to like pythoncomplete.vim that is shipped with Vim a lot more. It's simple, and most important to me, it's very stable, especially compared to solutions like jedi-vim/python-mode and YouCompleteMe.

This is what the default solution looks like. It doesn't offer completion of arguments, but just shows them in the preview window so it's easy for you to fill the keyword arguments in like so:

enter image description here

  • 2
    @lcd047: In what way does this not answer the question? The question was to find a solution to "autocomplete the arguments of a function (or show them at least.)". I suggested a solution that would show the arguments of a function. You proposed the completion of arguments, I proposed the showing of them. The questioner can pick his preference. I don't see the problem here. – akshay Jun 4 '15 at 4:05
  • I want to find more information on this plugin. How do you use it? Do I need ctags for it? – Neaţu Ovidiu Gabriel Feb 23 '16 at 12:21
  • @NeaţuOvidiuGabriel: this plugin is built into Vim, you don't need anything other than what my answer tells you. – akshay Feb 23 '16 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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