Shaobo Zi
Shaobo Zi

Reputation: 739

How to use Ctags to list all the references of a symbol(tag) in vim?

Can I list all the references of a symbol in vim using Ctags? like the 'Find References' In some GUI IDE.

The Ctag tutorial just tell how to locate the definition of a symbol ,not all the usages.

Upvotes: 19

Views: 20202

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172778

The ctags tool only collects and stores the definitions of symbols.

To find all references, you can use the cscope integration into Vim (:help cscope), but note that cscope supports far fewer programming languages than ctags.

Alternatively, a poor man's substitute would be the built-in :grep / :vimgrep commands (with proper patterns). Remember, Vim is a powerful text editor, but no IDE. Either you find and integrate a suitable external tool for this, or switch to a real IDE (like Eclipse, Visual Studio, or IntelliJ IDEA) for such code browsing.

Upvotes: 21

Related Questions