This means that if you are writing your Elixir code using an editor that supports Ctags (e.g. Vim, Emacs, Sublime Text, and many others), you can easily jump to the definition of any symbol. Handy for navigating your way around a large, unfamiliar source tree.
Copy or append this
.ctags file to your own
Once you have done that, you can build tags for an Elixir app with the usual ctags command line: cd into your project, and then
$ ctags -R .
What is this Exuberant Ctags thing and how do I use it?
Well, that's a separate topic, really. But here's a quick start.
Ctags is a tool to make it easier to implement "go to definition" in lots
of different text editors and for lots of different programming languages.
It has parsers for many languages, and it generates a simple
that any editor can read in order to find the file and line where a given
symbol is defined.
The original Ctags supported only C (I think). Exuberant Ctags is a rewrite that supports many more languages.
Install Exuberant Ctags
$ brew install ctags
On Windows, the best way is using chocolatey:
choco install ctags
If you are using the vim editor:
- Do the above
ctags -R .command
- Open an Elixir source file in vim.
- Put the cursor on any symbol name, and type the
^](Control-]) key. The cursor will jump to the definition of that symbol.
^T) to return cursor to previous location.
Sublime Text 2
- If you have not already done so, install Sublime Package Control.
- From Sublime Text, Cmd-Shift-P, "install package"
- Pick "CTags" from the list of packages, and install it
- Put the cursor on any symbol name, and then type
^T^T. This should jump to the symbol definition.
- See the rest of the key bindings here.
There are also other editors that support Ctags. Check your editor's documentation, or Google for it.
Feedback is more than welcome; I'm new to the Elixir language, so I probably got some things wrong.