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

岁酱吖の 提交于 2019-12-04 12:59:45

问题


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);
    }
};

(Code is from Aquaria's open source release.)

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.

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

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?


回答1:


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.

You can download it here:

https://github.com/MarcWeber/SmartTag

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



来源:https://stackoverflow.com/questions/8272458/how-can-i-make-vim-tag-jumps-as-smart-as-omnicppcomplete

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!