CTags
CTags support for Sublime Text
Details
Installs
- Total 303K
- Win 177K
- Mac 69K
- Linux 57K
Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | Oct 7 | Oct 6 | Oct 5 | Oct 4 | Oct 3 | Oct 2 | Oct 1 | Sep 30 | Sep 29 | Sep 28 | Sep 27 | Sep 26 | Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | Sep 18 | Sep 17 | Sep 16 | Sep 15 | Sep 14 | Sep 13 | Sep 12 | Sep 11 | Sep 10 | Sep 9 | Sep 8 | Sep 7 | Sep 6 | Sep 5 | Sep 4 | Sep 3 | Sep 2 | Sep 1 | Aug 31 | Aug 30 | Aug 29 | Aug 28 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 3 | 7 | 2 | 11 | 7 | 3 | 4 | 3 | 4 | 2 | 6 | 2 | 3 | 10 | 4 | 8 | 13 | 7 | 6 | 8 | 3 | 8 | 7 | 12 | 5 | 5 | 5 | 5 | 4 | 7 | 9 | 13 | 7 | 5 | 2 | 8 | 10 | 11 | 5 | 6 | 12 | 3 | 3 | 12 | 16 | 3 |
Mac | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 3 | 2 | 2 | 0 | 3 | 2 | 0 | 0 | 3 | 1 | 4 | 0 | 1 | 0 | 2 | 1 | 1 | 2 | 0 | 1 | 0 | 1 | 1 | 2 | 4 | 0 | 0 | 1 | 1 | 6 | 3 | 1 |
Linux | 1 | 0 | 3 | 1 | 3 | 3 | 1 | 2 | 2 | 1 | 2 | 0 | 3 | 1 | 1 | 0 | 5 | 3 | 5 | 2 | 0 | 0 | 1 | 0 | 2 | 1 | 1 | 3 | 2 | 2 | 3 | 5 | 3 | 2 | 0 | 1 | 3 | 4 | 4 | 2 | 2 | 3 | 0 | 0 | 1 | 3 |
Readme
- Source
- raw.githubusercontent.com
CTags
This Sublime Text package provides support for working with tags generated by Exuberant CTags or Universal CTags.
ctags
command is searched for on the system PATH. It works by doing a binary
search of a memory-mapped tags file, so it will work efficiently with very large
(50MB+) tags files if needed.
Installation
Package Control
The easiest way to install is using Package Control. It's listed as CTags
.
- Open
Command Palette
using menu itemTools → Command Palette...
- Choose
Package Control: Install Package
- Find
CTags
and hitEnter
Manual Download
- Download the
.zip
- Unzip and rename folder to
CTags
- Copy folder into
Packages
directory, which can be found using the menu itemPreferences → Browse Packages...
Using Git
Go to your Sublime Text Packages directory and clone the repository using the command below::
git clone https://github.com/SublimeText/CTags
Additional Setup Steps
Linux
To install ctags use your package manager.
- For Debian-based systems (Ubuntu, Mint, etc.)::
sudo apt-get install exuberant-ctags
or
sudo apt-get install universal-ctags
- For Red Hat-based systems (Red Hat, Fedora, CentOS)::
sudo yum install ctags
MacOS
The default ctags
executable in OSX does not support recursive directory
search (i.e. ctags -R
). To get a proper copy of ctags, use one of the
following options:
- Using Homebrew
brew install ctags
- Using MacPorts
port install ctags
Ensure that the PATH
is updated so the correct version is run:
- If
which ctags
doesn't point at ctags in/usr/local/bin
, make sure you add/usr/local/bin
to yourPATH
ahead of the folderwhich ctags
reported. - Alternatively, add the path to the new
ctags
executable to the settings, undercommand
. If you have Xcode / Apple Developer Tools installed this path will likely be/usr/local/bin/ctags
.
Windows
Download Exuberant CTags binary or Universal CTags binary
Extract
ctags.exe
from the downloaded zip toC:\Program Files\Sublime Text
or any folder within your PATH so that Sublime Text can run it.Alternatively, extract to any folder and add the path to this folder to the
command
setting.
Usage
This uses tag files created by the ctags -R -f .tags
command by default
(although this can be overridden in settings).
The plugin will try to find a .tags
file in the same directory as the
current view, walking up directories until it finds one. If it can't find one
it will offer to build one (in the directory of the current view)
If a symbol can't be found in a tags file, it will search in additional
locations that are specified in the CTags.sublime-settings
file (see
below).
If you are a Rubyist, you can build a Ruby Gem's tags with the following script:
require 'bundler'
paths = Bundler.load.specs.map(&:full_gem_path)
system("ctags -R -f .gemtags #{paths.join(' ')}")
Settings
To open CTags.sublime-settings
- Open
Command Palette
using menu itemTools → Command Palette...
- Choose
Preferences: CTags Settings
and hitEnter
filters
will allow you to set scope specific filters against a field of the tag. In the excerpt above, imports tags likefrom a import b
are filtered:
'(?P<symbol>[^\t]+)\t'
'(?P<filename>[^\t]+)\t'
'(?P<ex_command>.*?);"\t'
'(?P<type>[^\t\r\n]+)'
'(?:\t(?P<fields>.*))?'
extra_tag_paths
is a list of extra places to look for keyed by(selector, platform)
. Note theplatform
is tested againstsublime.platform()
so any values that function returns are valid.extra_tag_files
is a list of extra files relative to the original filecommand
is the path to the version of ctags to use, for example::
"command" : "/usr/local/bin/ctags"
or:
"command" : "C:\\Users\\<username>\\Downloads\\CTags\\ctag.exe"
The rest of the options are fairly self explanatory.
Hide .tags files from side bar
By default, Sublime will include ctags files in your project, which causes
them to show up in the file tree and search results. To disable this behaviour
you should add a file_exclude_patterns
entry to your
Preferences.sublime-settings
or your project file. For example:
"file_exclude_patterns": [".tags", ".tags_sorted_by_file", ".gemtags"]
Support
If there are any problems or you have a suggestion, open an issue, and we will receive a notification.
Commands Listing
Command | Key Binding | Alt Binding | Mouse Binding |
---|---|---|---|
rebuild_ctags | ctrl+t, ctrl+r | ||
navigate_to_definition | ctrl+t, ctrl+t | ctrl+> | ctrl+shift+left_click |
jump_back | ctrl+t, ctrl+b | ctrl+< | ctrl+shift+right_click |
show_symbols | alt+s | ||
show_symbols (all files) | alt+shift+s | ||
show_symbols (suffix) | ctrl+alt+shift+s |