Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 973
idbrii Avatar asked Nov 04 '22 10:11

idbrii


1 Answers

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

like image 105
Scott Smedley Avatar answered Nov 14 '22 01:11

Scott Smedley