Vim的Omnicompletion与Python是行不通的 [英] Vim's Omnicompletion with Python just doesn't work

查看:609
本文介绍了Vim的Omnicompletion与Python是行不通的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜查一小时左右,无论是对堆栈溢出和其他地方。唉!请帮忙。 Vim的omnicompletion刚刚的不工作

I've searched around for an hour, both on Stack Overflow and elsewhere. Alas! Please help. Vim's omnicompletion just doesn't work.


  1. 我的Vim 7.2编译Python的支持。

  1. I have Vim 7.2 compiled with Python support.

文件类型插件在我的的.vimrc

filetype plugin on is in my .vimrc.

的.py 文件打开后,:回声和放大器; omnifunc 打印 pythoncomplete#完成

我和一个大的项目工作,我有生成文件中的标签exhuberant-ctags的。它在Vim的的ctags 路径。我可以通过键入测试<大骨节病> ^] 上一个符号,那么我带到符号的定义。

I'm working with a large project and I have a tags file generated with exhuberant-ctags. It's in Vim's ctags path. I can test it by typing ^] on a symbol and I'm then taken to the symbols' definition.

更新1:所有我的项目的code是在Python-在Vim的路径。我能:蟒蛇进口的myproject 成功

Update 1: All of my project's code is in the python-in-Vim's path. I can :python import myproject successfully.

现在,无论我尝试<大骨节病> C-X C-O ,我得到的是:

Now, anywhere I try C-x C-o, all I get is:

-- Omni completion (^O^N^P) Pattern not found

我在做什么错了?

What am I doing wrong?

更新2::当我键入<大骨节病> CX联合道道通在模块级,Vim会显示与其他模块的几个模块级常数完成弹出在我的项目。但它只是常数(符号大写字母),并完成仍然无法正常工作其他地方。

Update 2: When I type C-x C-o C-n at the module-level, Vim displays a completion popup with a few module-level constants from other modules in my project. But it's only constants (symbols capital letters) and the completion still doesn't work anywhere else.

更新3:我发现,<大骨节病> CX有限公司在文件的顶部开始某种omnicompletion,并完成了 pprint。 可以调出菜单,并在 pprint 模块的一切快速参考。然而,没有我自己的模块的进口正在完成。

Update 3: I've found that C-x C-o at the top of the file starts some kind of omnicompletion, and completion for pprint. brings up the menu and quick-reference of everything in the pprint module. However, none of my own module's imports are being completed.

更新4,一年后:我放弃了,学会了Emacs的。我一直在黑暗的一面,阴谋和香料的神秘土地,我对你说,我已经找到了路。

Update 4, one year later: I gave up and learned Emacs. I have been to the dark side, the mystical land of intrigue and spice, and I say to thee that I have found The Way.

更新5,两年后:我回到Vim的。 Emacs是美丽的,但即使一年半后的Emacs,我还是快了越来越Vim中所做的工作。我已经不再编写Python但就目前而言,并不能测试这些建议如何工作。

Update 5, two years later: I went back to Vim. Emacs is beautiful, but even after 1.5 years of Emacs, I'm still faster at getting work done in Vim. I've stopped writing Python for now, however, and can't test how well these suggestions work.

推荐答案

什么模块包含你正在试图完成的象征?它是在Python STDLIB?或者它是一个第三方的模块?

What module contains the symbol you are trying to complete? Is it in the python stdlib? Or is it a third-party module?

请确保模块/包是在PYTHONPATH。

Make sure that the module/package is in the PYTHONPATH.

在Vim的时候,做的:

In Vim, do:

:python import sys
:python print sys.path

要添加模块的目录:

:python sys.path.append("/path/to/directory/")

这篇关于Vim的Omnicompletion与Python是行不通的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆