Vim:将omnicomplete显示的方法限制为ctags中存在的方法
我正在编辑一个简单的 PHP 文件,其中包含一个具有一些方法的类,如果 $bar
是此类的实例并且我输入
$bar->
ctrlxctrlo
除了我的班级的方法之外,我还收到一个弹出窗口,其中包含许多方法(内置方法)并出现在 ctags 列表中。如何避免显示所有这些外部方法并仅保留我的类中定义的方法?
I'm editing a simple PHP file with a class which has a few methods, if $bar
is an instance of this class and I type
$bar->
ctrlxctrlo
I get a popup with a lot of methods (builtin ones) in addition to those of my class and present in the ctags list. How can avoid showing all those external methods and just keep the ones defined in my class?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我确信您已经看过 VIM 文档 (
:help ft-c-omni
):如果我没看错的话,内置功能充其量只允许您使用 CTRL-P 并匹配局部变量名称,从而完全绕过 TAGS 文件。
您真正想要的是特定于您当前正在处理的翻译单元(头文件/cpp 文件)的 TAGS 文件。如果我试图解决这个问题,我将执行以下步骤:
CTRL-X CTRL-O
全方位补全。如有必要,恢复到原始标签。另外,在我看来,您似乎希望能够直接从 VIM 调用 #1 的脚本,因为您在编码时会经常更改当前的翻译单元。
我希望这能让您朝着正确的方向开始,我很高兴看到/帮助您实施=)。
I'm sure you've seen the VIM documentation (
:help ft-c-omni
) for this:If I read that correctly, the built-in functionality will, at best, only allow you to use CTRL-P and match the local variables names thus bypassing the TAGS file altogether.
What you really want is a TAGS file that is specific to the translation unit that you're currently working on (header/cpp file). Here are the steps that I would perform if I were trying to solve this problem:
CTRL-X CTRL-O
omni-completion. If necessary, revert to the original TAGS.Also, it seems to me like you would want to be able to call the script for #1 directly from VIM since you would be frequently changing the current translation unit as you code.
I hope that gets you started in the right direction, and I'd be happy to see / help you with an implementation =).