Search code examples
c++vimvim-plugin

How can I "Go to Declaration" using VIM without going through a long list?


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.


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.