在VIM对象实例的Python自动完成 [英] Python autocompletion on object instances in VIM

查看:151
本文介绍了在VIM对象实例的Python自动完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经找到了一个VIM奇怪的现象,当我尝试使用对象上的自动完成功能:

如果我实例化一个模块级的对象时,自动完成VIM将在我创建实例工作

如果我尝试同样的当一个函数或类是没有较长的工作:

有谁知道如何解决这个问题,或者是有没有办法让omnicompletion在非模块范围的情况下工作吗?


解决方案

尽管它不使用Vim的omnicompletion插件,通过使用绳索,ropemode和ropevim有可能获得的方法自动完成:

虽然算不上什么,我想它的工作原理pretty很好。

我得到它的工作是这样的:
我这里安装了的ropevim分布,并添加以下行到我的.vimrc文件里:

 自动完成绳
让ropevim_vim_completion = 1
让ropevim_extended_complete = 1
让G:ropevim_autoimport_modules = [OS *,追溯,Django的*,xml.etree]
IMAP c为C-空间> < C-R> =绳codeAssistInsertMode()< CR>

现在pressing Ctrl +空格键会弹出绳子完成菜单。

I have found a strange behavior in VIM when I attempt to use autocompletion on objects:

If I instantiate the objects on a module level, the VIM autocompletion will work on the instance I create:

If I try the same when in a function or class it is not longer working:

Does anyone know how to fix this, or is there no way to get omnicompletion working on instances in a non module-scope?

解决方案

Even though it does not use Vim's omnicompletion plugin, by using rope, ropemode and ropevim it is possible to get autocompletion in methods:

Even though not really exactly what I wanted it works pretty well.

I got it working like this: I installed the ropevim distribution from here and added the following lines to my .vimrc file:

" Rope AutoComplete
let ropevim_vim_completion = 1
let ropevim_extended_complete = 1
let g:ropevim_autoimport_modules = ["os.*","traceback","django.*", "xml.etree"]
imap <c-space> <C-R>=RopeCodeAssistInsertMode()<CR>

Now pressing Ctrl+Space will bring up the rope completion menu.

这篇关于在VIM对象实例的Python自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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