Ctags is not always the best solution to this today. There are Language Server implementations for some modern languages that would offer these features and more. Also, as of 2019, there are other ctags alternatives to consider today, such as Universal Ctags.
Ctags lets you navigate code fast, and is perhaps the single most useful productivity boosting tool in any developer's arsenal. If you're not using Ctags yet, let's get you started.
Ctags indexes a project's tags, or names of its classes and methods. Coupled with some integration with your editor (shown: Vim's unite-tag), it will give you two interesting features to help you traverse code base:
In OS X, use Homebrew to install Exuberant Ctags. This is a more useful version of ctags than the one that ships with Xcode.
Let's make ctags ignore some common directories. Save this file as
Go to your project's path, and run ctags to generate a
tags file in your project. This is the index of all tags in your project that your editor will use.
It's safe to make all projects ignore all files called
tags. I recommend setting up a global git ignore list.
Use vim-autotag to automatically update
tags files. This will only work on projects that have already had
ctags -R performed before.
:tag to go to the definition of a certain tag. Usually, you will want to use this to jump to a certain Class or Method. Yes, this supports tab completion!
vim -t to open vim to a certain tag.
If you used
:tag on a tag that's got multiple definitions, use these commands to sift through them all.
|Move to next definition (|
|Move to previous definition (|
|List all definitions (|
You can also place your cursor on some text and press
^] to jump to that tag.
|Jump to definition|
|Jump back from definition|
|See all definitions|