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.
EDIT:
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?
pythoncomplete#Complete
is for python2, you need to usepython3complete#Complete
. I think you must set either the 'omnifunc' or 'completefunc' option, I can't remember which one