It used to work when I used python2, but now I can't use ^X^O to complete function names.

I do have vim with -python and +python3 (on Ubuntu 16.04), but here is the error I get when trying Ctrl-X Ctrl-O:

Error: Required vim compiled with +python
E117: Unknown function : pythoncomplete#Complete
Press ENTER or type command to continue

How can I get a working python3-completion in Vim? Thanks a lot.

I don't want to use any completion plugin, since this is supposed to work with normal vim. I have looked at this question, but no answer helps.


Checking where omnifunc was defined with verbose set omnifunc?, it says /usr/share/vim/vim74/ftplugin/python.vim

As suggested by @ChristianBrabandt, when I set omnifunc to python3complete#Complete, it can complete a few stuff, like sys., but still doesn't work for other modules, e.g argparse. Why is that?

So a temporary fix is to set omnifunc in my ~/.vim/ftplugin/python.vim, unless anyone has a better suggestion?

  • 2
    pythoncomplete#Complete is for python2, you need to use python3complete#Complete. I think you must set either the 'omnifunc' or 'completefunc' option, I can't remember which one Jan 30, 2018 at 13:24
  • Ah, you're right, it works better. Still does not complete everything though, so I edited my question. Jan 30, 2018 at 13:40


Your Answer

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

Browse other questions tagged or ask your own question.