Question

I'm reading a huge cpp project with hundreds of .cpp and .h files, and I want to do it more efficiently by using the "Go to Declaration" function.

I tried vim + ctags + cscope, but when I "Go to Declaration" by using "Ctrl + ]", it came up a LONG LONG list of "declaration" for me to select.

For example, I want to find the declaration of "class Foo::reset()", but it comes to me lots of candidates such as "class Bar::reset()" or "Class Blahblah::reset()".

I wonder if there is a fascinating way to find the REAL DECLARATION of a function, but not to choose the right one for a long list manually.

Thanks.

Was it helpful?

Solution

Neither Vim, nor ctags nor cscope have the ability to understand your code and go to the declaration you want.

You might want to try Clang-based YouCompleteMe or clang-complete.

OTHER TIPS

It is a heavy-weight solution, but you could also install Eclipse with the C/C++ Developer tools, and use the Eclim plugin (eclim.org) to talk to Eclipse for searches and completion.

The YouCompleteMe plugin supports that.

Both CLion and VSCode are much better than Eclipse, provide this functionality and have Vim plugins.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top