开发者

Python omnicompletion in Vim editor not working

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:

  1. :echo开发者_如何学运维 &omnifunc prints pythoncomplete#Complete.
  2. the .vim/doc/tags file has R tags, but no python (but this is because python is supported by default right?)
  3. If I do import math in my .py file I can autocomplete eg. ma to math. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜