如何使vim标签跳转像OmniCppComplete一样聪明? [英] How can I make vim tag jumps as smart as OmniCppComplete?

查看:118
本文介绍了如何使vim标签跳转像OmniCppComplete一样聪明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会这样生成我的代码(旺盛的Ctags 5.9〜svn20110310):

I generate my tags (Exuberant Ctags 5.9~svn20110310) like this:

 ctags --c++-kinds=+p --fields=+iaS --extra=+q -L ctags.files

我大致具有以下类结构:

I have roughly this class structure:

class RenderObject
{
    InterpolatedVector offset;
};

class Quad : public RenderObject
{
};

class KeyframeWidget : public Quad
{
    void shiftRight()
    {
        if (!offset.isInterpolating())
            offset.interpolateTo(Vector(offset.x+80, 0), 0.1, 0, 0, 0);
    }
};

(代码来自 Aquaria的开源版本.)

如果我标记跳转到offset( Ctrl -] ),那么我在代码库中的每个offset都会得到一个列表.在我键入offset.shiftRight()的末尾之后,OmniCppComplete开始仅提供InterpolatedVector的补全.

If I tag jump on offset (Ctrl-]), then I get a list every offset in my codebase. After I type offset. to the end of shiftRight(), OmniCppComplete starts offering completions only for InterpolatedVector.

如何使我的标签跳跃得像 OmniCppComplete 一样聪明?

How can I make my tag jumps as smart as OmniCppComplete?

仅仅是标签跳转不使用任何上下文,因此它们仅知道符号名称吗? (与:tag <C-r><C-w><CR>完全相同吗?)是否有vim替代方法可以使它们具有上下文意识?

Is it just that tag jumps don't use any context, so they only know symbol names? (Is it the exact same as :tag <C-r><C-w><CR>?) Is there a vim alternative that makes them context-aware?

推荐答案

我最近开始将SmartTag插件用于Vim&发现它非常善于使用周围C ++代码中的上下文信息来找到正确的标记.

I recently started using the SmartTag plugin for Vim & find it very good at using contextual information from the surrounding C++ code to find the right tag.

您可以在这里下载:

https://github.com/MarcWeber/SmartTag

要在Ctrl-]中使用它,您将需要在tagfunc中使用Vim版本 已应用补丁.在这里:

To be able to use it with Ctrl-] you will need to use a Vim release with the tagfunc patch applied. It's here:

http://llorens.visualserver.org/vim73-tagfunc.zip

这篇关于如何使vim标签跳转像OmniCppComplete一样聪明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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