Skip to content

Instantly share code, notes, and snippets.

@gcentauri
Created March 5, 2024 17:35
Show Gist options
  • Save gcentauri/2ecce4ce902e6a355c3b7bd53a30bca1 to your computer and use it in GitHub Desktop.
Save gcentauri/2ecce4ce902e6a355c3b7bd53a30bca1 to your computer and use it in GitHub Desktop.

Universal Ctags

https://ctags.io/

Despite the wealth of available options, defaults are set so that ctags is most commonly executed without any options (e.g. "ctags *", or "ctags -R"), which will create a tag file in the current directory for all recognized source files.

Excluding files

ctags -R –exclude=@.ctags-exclude

Use a file to store patterns to exclude, one per line, like .gitignore. Example:

#+name ctags-exclude

node_modules/*
test/*
public/*
tmp/*
bin/*
config/*

Tagging the project gems

You can run bundle install and set the path to install gems inside your project so when you run ctags - R . all the gems get indexed.

bundle install –path=vendor/bundle

Emacs

  1. citre

    Website: https://github.com/universal-ctags/citre

    Citre is an advanced Ctags (or actually, readtags) frontend for Emacs. It offers:

    • auto-completion (by `completion-at-point').

    • xref and imenu integration.

    • `citre-jump', a `completing-read' UI for jumping to definition.

    • `citre-peek', a powerful code reading tool that lets you go down the rabbit hole without leaving current buffer.

      (require 'citre) (require 'citre-config)

Vim(s)

just works?

VS Code

https://marketplace.visualstudio.com/items?itemName=gediminaszlatkus.ctags-companion

https://marketplace.visualstudio.com/items?itemName=jaydenlin.ctags-support

Sublime

maybe - this seems to work with exuberant ctags, but not universal 🫤 https://packagecontrol.io/packages/CTags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment