I am trying to use vim on my Python journey, based on this guide.
I think I have the same problem as a paid nerd but since they didn't find a solution I am posting again here.
For some reason I can't get omnicompletion to work in vim, with python. I have installed the fabulous R-plugin and built the tags list. So I get omnicompletion with R.
But not for Python. A few observations:
:echo开发者_如何学运维 &omnifunc
printspythoncomplete#Complete
.- the
.vim/doc/tags
file has R tags, but no python (but this is because python is supported by default right?) - If I do
import math
in my.py
file I can autocomplete eg.ma
tomath.
but no methods are found?
How can I proceed?
It appears that the default omnicompletion for python (pythoncomplete#Complete
) does not know about buildins/keywords.
When you Ctrl-XCtrl-O on math.
(if you have imported "math") you should see the available math.
functions but to do so for print
, sorted
etc I think you need a plugin like:
- Pydiction or
- PySmell
check ~/.vim directory ,inside doc directory you should have NERD_tree.txt, so you should have nerd tree plugin installed. . .
I assume all modules you are importing are in Python path, right? Check if all of your imports in this file are working, in my case one failing import (syntax error in module being imported) broke omnicompletion.
.vim/doc/tags
contains tags for the Vim documentation (including the R plugin), and this has nothing to do with the tags used for completion. You can regenerate them using
:helptags ~/.vim/doc
When it comes to completion, which keyboard shortcut do you use? By default the omni-complete is bound to Ctrl-X Ctrl-O
, not the usual Ctrl-N
.
There are a number of plugins for python completion. The vim python filetype plugin appears to be the best at this point. It requires a vim built with python support, and should otherwise work out of the box. Completion of system modules will just work, and you'll their methods in omnicompletion.
精彩评论