Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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

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