├── .ctags ├── LICENSE └── README.md /.ctags: -------------------------------------------------------------------------------- 1 | --langdef=Elixir 2 | --langmap=Elixir:.ex.exs 3 | --regex-Elixir=/^[ \t]*def(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\2/f,functions,functions (def ...)/ 4 | --regex-Elixir=/^[ \t]*defcallback[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/c,callbacks,callbacks (defcallback ...)/ 5 | --regex-Elixir=/^[ \t]*defdelegate[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/d,delegates,delegates (defdelegate ...)/ 6 | --regex-Elixir=/^[ \t]*defexception[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/e,exceptions,exceptions (defexception ...)/ 7 | --regex-Elixir=/^[ \t]*defimpl[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/i,implementations,implementations (defimpl ...)/ 8 | --regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)\(/\2/a,macros,macros (defmacro ...)/ 9 | --regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-zA-Z0-9_?!]+)?[ \t]+([^ \tA-Za-z0-9_]+)[ \t]*[a-zA-Z0-9_!?!]/\3/o,operators,operators (e.g. "defmacro a <<< b")/ 10 | --regex-Elixir=/^[ \t]*defmodule[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/m,modules,modules (defmodule ...)/ 11 | --regex-Elixir=/^[ \t]*defprotocol[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/p,protocols,protocols (defprotocol...)/ 12 | --regex-Elixir=/^[ \t]*Record\.defrecord[ \t]+:([a-zA-Z0-9_]+)/\1/r,records,records (defrecord...)/ 13 | --regex-Elixir=/^[ \t]*test[ \t]+\"([a-z_][a-zA-Z0-9_?! ]*)\"*/\1/t,tests,tests (test ...)/ 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ctags-elixir 2 | ============ 3 | 4 | [Exuberant CTags](http://ctags.sourceforge.net/) support for the 5 | [Elixir](http://elixir-lang.org/) language. 6 | 7 | This means that if you are writing your Elixir code using an editor 8 | that supports Ctags (e.g. Vim, Emacs, Sublime Text, and many others), you 9 | can easily jump to the definition of any symbol. Handy for navigating 10 | your way around a large, unfamiliar source tree. 11 | 12 | To enable: 13 | ---------- 14 | 15 | Copy or append this `.ctags` file to your own `~/.ctags`. 16 | 17 | Once you have done that, you can build tags for an Elixir app with the usual 18 | ctags command line: cd into your project, and then 19 | 20 | $ ctags -R . 21 | 22 | What is this Exuberant Ctags thing and how do I use it? 23 | ------------------------------------------------------- 24 | 25 | Well, that's a separate topic, really. But here's a quick start. 26 | 27 | Ctags is a tool to make it easier to implement "go to definition" in lots 28 | of different text editors and for lots of different programming languages. 29 | It has parsers for many languages, and it generates a simple `tags` file 30 | that any editor can read in order to find the file and line where a given 31 | symbol is defined. 32 | 33 | The original Ctags supported only C (I think). Exuberant Ctags is a rewrite 34 | that supports many more languages. 35 | 36 | **Install Exuberant Ctags** 37 | 38 | If you don't already have Exuberant Ctags, [install it](http://ctags.sourceforge.net/). 39 | On OSX, the best way is using [brew](http://mxcl.github.com/homebrew/): 40 | 41 | $ brew install ctags 42 | 43 | On Windows, the best way is using [chocolatey](https://chocolatey.org/): 44 | 45 | choco install ctags 46 | 47 | **Vim** 48 | 49 | If you are using the [vim](http://www.vim.org/) editor: 50 | 51 | 1. Do the above `ctags -R .` command 52 | 2. Open an Elixir source file in vim. 53 | 3. Put the cursor on any symbol name, and type the `^]` (Control-]) key. 54 | The cursor will jump to the definition of that symbol. 55 | 4. Type `^O` (or `^T`) to return cursor to previous location. 56 | 57 | **Sublime Text 2** 58 | 59 | If you are using [Sublime Text](http://www.sublimetext.com/), there is a 60 | [package](https://github.com/SublimeText/CTags) you can install that 61 | adds CTags support. I haven't tried it, but this is what you would do: 62 | 63 | 1. If you have not already done so, install [Sublime Package 64 | Control](http://wbond.net/sublime_packages/package_control). 65 | 2. From Sublime Text, Cmd-Shift-P, "install package" 66 | 3. Pick "CTags" from the list of packages, and install it 67 | 4. Put the cursor on any symbol name, and then type `^T^T`. This 68 | should jump to the symbol definition. 69 | 5. See the rest of the key bindings [here](https://github.com/SublimeText/CTags). 70 | 71 | **Other editors** 72 | 73 | There are also other editors that support Ctags. Check your editor's 74 | documentation, or Google for it. 75 | 76 | Feedback 77 | -------- 78 | 79 | Feedback is more than welcome; I'm new to the Elixir language, so I 80 | probably got some things wrong. 81 | --------------------------------------------------------------------------------