如何获得vim的omnicompletion使用支持PHP类方法:: [英] How do I get vim omnicompletion to support php class methods using ::

查看:191
本文介绍了如何获得vim的omnicompletion使用支持PHP类方法::的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用vim + PHP + ctags的,我可以得到相当不错的PHP自动完成。但是,一部分真正躲开我:让VIM来自动完成类的方法。这里有一个例子:

Using vim + php + ctags I can get fairly good php auto-completion. But one part really eludes me: getting vim to auto-complete class methods. Here's an example:

完整的方法是

CVarDumper::dumpAsString

和我想它,如果我键入此完成:

And I want it to complete if I type this:

CVarDumper::d<tab>

的双冒号不起作用。但是,如果我替换 然后它自动完成:

CVarDumper.d<tab>

我看到 C ++ omnifunc 函数有一个选项,允许为完成:

I see the c++ omnifunc function has an option to allow for :: completion:

let OmniCpp_MayCompleteScope = 1 " autocomplete after ::

时有一个相当于为 FT-PHP-全函数或方式破解这个功能?

Is there an equivalent for the ft-php-omni function, or a way to hack this feature in?

更新:

原来,问题是 SUPERTAB插件,特别是这个选项在我的.vimrc

Turns out the problem was the supertab plugin, specifically this option in my .vimrc

" SuperTab option for context aware completion                                                                          
let g:SuperTabDefaultCompletionType = "context"

移除选项 SUPERTAB +的 phpcomplete 允许的PHP类的方法完成。

After removing that option supertab + phpcomplete allows for completion of php class methods.

推荐答案

尝试这替代 phpcomplete 脚本。它比默认的在每一个可能的方式,包括它支持静态完成的事实越好。

Try this alternative phpcomplete script. It is better than the default one in every possible ways, including the fact that it supports static completion.

这篇关于如何获得vim的omnicompletion使用支持PHP类方法::的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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