Passing_Pancake
Passing_Pancake

Reputation: 1

How to use sublime text 2 and Ctags for erlang source code?

I install the Ctags by package control. And I also use the sublime-erlang. Most of the time it works well. But sometimes I could want to see how it implement in erlang stdlib It's this possible to jump into stdlib? And how?

Upvotes: 0

Views: 2300

Answers (1)

Keynslug
Keynslug

Reputation: 2766

Ok, the settings which make it possible are slightly covered on the CTags plugin homepage.

Consider your erlang installation is located at /usr/lib/erlang as it usually does, then do the following:

  1. Cd into your project or workspace directory, which is better for you.

  2. Feed into the shell:

    ctags --languages=erlang --erlang-kinds=-dr -R -f .libtags \
    /usr/lib/erlang/lib/kernel-*/src \
    /usr/lib/erlang/lib/stdlib-*/src
    

    ... and so on for all the otp applications you are interested in.

    It is important to specify absolute paths.

  3. Open your project specific settings in the Sublime Text (usually $PROJECT.sublime-project, if it does not exists, would be better to create one through Project > Save Project As...).

  4. Append to the settings section file path to the .libtags we have created before. On my machine that file most of the time looks like this:

    {
        "folders":
        [
            {
                "path": "/home/keynslug/workspace/projectname",
                "file_exclude_patterns": ["*.beam", "*.app", ".tags*"]
            }
        ],
        "settings": {
            "ctags_extra_tag_files": [
                "/home/keynslug/workspace/.libtags"
            ]
        }
    }
    
  5. Save and rebuild ctags.

Then if everything went well you would be able to dig into library function definitions as usual.

Upvotes: 2

Related Questions