I'm using Vim for a C++ project that I've started working on and I've been spending a lot of time lately browsing through the existing code to get a hang of it. To make the browsing easier, I've setup ctags and cscope in Vim to jump to definitions and find references.
However, I find that neither of them are intelligent enough to know which class a member variable/function belongs to. For example:
class Square;
...
Square a;
...
a.rotate();
Attempting to find the definition of rotate()
will bring up member functions from other classes too, like Triangle. I use g]
in Vim to bring up a list of matching tags and fortunately ctags lists the associated class for each entry. However, when there are 200 classes with the same member function, it can be tiresome to hunt down the correct tag.
Also, if I am at a function definition:
Square::rotate()
{
...
}
Attempting to find all calls to rotate()
using cscope brings up calls to Triangle's and other classes' rotate functions.
Because of this, I find myself jumping to Visual Slickedit every now and then to find the definition or reference to a member function or member variable. Is there any way I can accomplish this in good old Vim?
SrcExpl might be the plugin you needed. Try it.
I've looked for better solutions than cscope in the past, but never found something. In the end perhaps cscope lack of intelligence isn't really that much of a bother.
The problem is that there is no powerful and open intellisense library on the market. Perhaps CodeInsight.
Seems like this would be a good candidate http://vim.wikia.com/wiki/C%2B%2B_code_completion. I had some good luck with it doing similar things in Java. Not entirely sure it gets you everything you're trying to do though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With