Question

Is there any utility or plugin which provides cscope like functionality for C++. I am looking for

  • all references to a symbol
  • global definitions
  • functions called by a function
  • functions calling a function
  • files including a file
Was it helpful?

Solution

Vim can interface directly with cscope out of the box. Type :h cscope. This requires cscope functionality to be enabled when Vim is compiled and for cscope to be installed on your computer.

There is a Vim + cscope tutorial on the cscope web page.

OTHER TIPS

There are some tolls listed in the thread https://www.reddit.com/r/emacs/comments/1qktcb/cscope_like_functionality_that_correctly_handles/:

Some other links

  • https://ruben2020.github.io/codequery/ "CodeQuery is a project that attempts to combine the features available from both cscope and ctags, provide faster database access compared to cscope (because it uses sqlite) and provides a nice GUI tool as well.", has own gui and vim plugin https://github.com/devjoe/vim-codequery; can't generate cscope database, but its own "CodeQuery sqlite3 db" is converted from cscope.out, generated by pycscope for python; starscope for Ruby, Go and Javascript; original cscope for C and limited C++; can also use TAGS.
  • https://github.com/cquery-project/cquery "cquery is a highly-scalable, low-latency language server for C/C++/Objective-C. It is tested and designed for large code bases like Chromium. cquery provides accurate and fast semantic analysis without interrupting workflow." ... finding definition/references, with clang, C/C++; very quick work, fast updates and eats a lot of RAM. Has vim support: https://github.com/cquery-project/cquery/wiki/Vim
  • https://www.gnu.org/software/global/ GNU Global is sometimes recommended as cscope replacement. It has "locate not only definitions but also references" and supports " 6 languages by built-in parser. (definition and reference): C, C++, Yacc, Java, PHP4 and assembly." And Vim integration: https://www.gnu.org/software/global/globaldoc_toc.html#Vim-editor

And there are some fast (indexed) greps like Russ Cox’ codesearch tools (It works with regex too - https://github.com/google/codesearch; example is https://codesearch.debian.net/about) or any other indexed grep...

And there are cross ref tools (GUI and web-servers) like LXR and other... https://github.com/oracle/opengrok/wiki/Comparison-with-Similar-Tools

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