2

Is it possible to include other type of file in the search result(e.g find the value of CFLAG in the makefile)? Thanks.

user903151
  • 55
  • 1
  • 1
  • 6

2 Answers2

4

Cscope is an excellent tool, but it really only understands C. (And boy, I wish it understood more C; I can't tell you how often I wished I could use Cscope to find a definition of a structure.)

Exuberant Ctags, on the other hand, understands a lot of languages (42 by my ctags --list-languages), one of which is Make.

Run ctags -R . to build a tags database of your source. (ctags has many command line options to configure how it works but this simple invocation works for me in a variety of projects.) Then you can run vim -t CFLAGS to jump right to the definition of CFLAGS in the Makfile. (It also enables the simple ctrl+] lookup in vim -- see vim's :help CTRL-] for details.)

I usually use cscope, ctags, and gid all together in my own source navigating -- each tool does different enough things that most of my needs can be met with one of them -- the trick is figuring out which task is best suited to which tool.

sarnold
  • 102,305
  • 22
  • 181
  • 238
  • This is an old answer, but thank you. I didn't know about "Exuberant Ctags", but discovered it after seeing your answer. It seems like a nice upgrade over the stock one. – Randy Howard Mar 24 '13 at 08:03
0

There is a ruby gem that is cscope-like but supports ruby and golang. It is also extensible, so other languages can be added relatively easily.

http://rubygems.org/gems/starscope

Evan
  • 6,369
  • 1
  • 29
  • 30