• Stars
    star
    989
  • Rank 44,805 (Top 1.0 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 13 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

CTags support for Sublime Text

CTags

About

This Sublime Text 2/3 package provides support for working with tags generated by Exuberant CTags

The 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.

See this forum thread for a bit of historical background on the Sublime Text plugin.

Installation

The easiest way to install this plugin, is to use the Package Control plugin, by Will Bond

Alternatively, the plugin can be installed manually using one of the following methods.

Using Git

Go to your Sublime Text Packages directory and clone the repository using the command below:

$ git clone https://github.com/SublimeText/CTags

Manual Download

  • Download the files using the .zip download option
  • Unzip the files (and rename the folder to CTags if needed)
  • Copy the folder to your Sublime Text Packages directory

Additional Setup Steps

OS X

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:

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 your PATH ahead of the folder which ctags reported.
  • Alternatively, add the path to the new ctags executable to the settings, under command. If you have Xcode / Apple Developer Tools installed this path will likely be /usr/local/bin/ctags.

Linux

To install ctags use your package manager.

  • For Debian-based systems (Ubuntu, Mint, etc.):

    sudo apt-get install exuberant-ctags
    
  • For Red Hat-based systems (Red Hat, Fedora, CentOS):

    sudo yum install ctags
    

And so forth

Windows

  • Download the CTags binary from the Exuberant CTags site.
  • Extract ctags.exe from the downloaded zip to C:\Program Files\Sublime Text 2 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 overriden 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

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"]

In addition to this setting, there's a CTags.sublime-settings file, which can be edited like any other .sublime-settings file

  • filters will allow you to set scope specific filters against a field of the tag. In the excerpt above, imports tags like from 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 the platform is tested against sublime.platform() so any values that function returns are valid.

  • extra_tag_files is a list of extra files relative to the original file

  • command 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.

Support

If there are any problems or you have a suggestion, open an issue, and we will receive a notification.

Thanks :)

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_prev 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    

More Repositories

1

Spacegray

A Hyperminimal UI Theme for Sublime Text
JavaScript
7,225
star
2

LaTeXTools

LaTeX plugin for Sublime Text
Python
2,002
star
3

Origami

Split the window however you like! Create new panes, delete panes, move and clone views from pane to pane.
Python
1,193
star
4

TrailingSpaces

Highlight trailing spaces and delete them in a flash.
Python
894
star
5

AdvancedNewFile

File creation plugin for Sublime Text
Python
823
star
6

BetterCoffeeScript

Syntax highlighting and checking, commands, shortcuts, snippets, watched compilation and more.
Python
437
star
7

PackageDev

Tools to ease the creation of snippets, syntax definitions, etc. for Sublime Text.
Python
430
star
8

VintageEx

An implementation of Vim's command-line mode for Sublime Text 2
Python
381
star
9

PowerShell

Support for the MS PowerShell programming language.
PowerShell
312
star
10

ColdFusion

ColdFusion Sublime Text Package
Python
198
star
11

VBScript

VBScript package for Sublime Text
Python
183
star
12

WordHighlight

Highlight all copies of the currently selected word.
Python
178
star
13

PhpDoc

PhpDoc support package.
JavaScript
165
star
14

RSpec

Sublime Text 2 / 3 plugin for RSpec BDD Framework
Python
125
star
15

InsertNums

Sublime Text plugin for inserting sequences. Supporting alphanumerics and hex, with bitwise operations!
Python
122
star
16

UnitTesting

Testing Sublime Text Packages
Python
110
star
17

IndentGuides

Draw vertical guides to easily visualize indent depth.
Python
106
star
18

Mote

SFTP Remote Editing for Sublime Text 2
Python
105
star
19

Pywin32

Pywin32 support for sublime (win32api etc)
Python
81
star
20

ElasticTabstops

Tab characters automatically adjust to keep adjacent lines aligned.
Python
67
star
21

PhpBeautifier

Pear Php_beautifier plugin for Sublime Text 2
Python
66
star
22

SaneSnippets

Sublime Text snippets optimized for humans, not robots
Python
59
star
23

Theme-DAneo

A theme for Sublime Text 3.2+ inspired by the popular DA UI
Python
52
star
24

sublime_lib

Utility library for frequently used functionality in Sublime Text and convenience functions or classes
Python
52
star
25

LegacyColorSchemes

Color schemes that were part of Sublime Text 2 and older builds of Sublime Text 3
48
star
26

Sass

Sass and SCSS syntax for Sublime Text
SCSS
48
star
27

material-theme

Material Theme, a theme for Sublime Text 3, made by Mattia Astorino
Python
41
star
28

GenerateUUID

Generate UUID for Sublime Text
Python
41
star
29

NSIS

Sublime Text plugin for the Nullsoft Scriptable Install System
Shell
40
star
30

WinMerge

Plugin that enables comparison of the last 2 activated buffers (even in different windows) using WinDiff (Windows only).
Python
36
star
31

InactivePanes

Sublime Text plugin that slightly dims (or grays) inactive panes in your group view
Python
32
star
32

SublimeHg

Use Mercurial from Sublime Text.
Python
30
star
33

StatusBarFileSize

Show the file size in the Sublime Text status bar
Python
27
star
34

QML

QML support for Sublime Text and Sublime Merge
QML
27
star
35

MouseEventListener

Adds on_pre_click and on_post_click callbacks to Sublime Text's plugin API.
JavaScript
24
star
36

Mojolicious

Mojolicious package for the Perl Web Dev Framework for Sublime Text 2
JavaScript
22
star
37

TailwindCSS

Tailswind CSS syntax for Sublime Text
CSS
22
star
38

NaturalDocs

NaturalDocs package for SublimeText 2
JavaScript
21
star
39

RevertFontSize

Sublime Text plugin to quickly revert to a preferred font size
Python
20
star
40

Modelines

Vim-like modelines for Sublime Text.
Python
20
star
41

ExtractSublimePackage

Extract .sublime-package files to the Sublime Text Packages folder.
Python
19
star
42

LegacyTheme

Sublime Text 2's default theme with retina graphics
19
star
43

KnowledgeBase

Sublime Text Knowledge Base
Python
18
star
44

ScrollOffset

Python
18
star
45

UberSelection

Commands to extend the functionality of Sublime Text's multiselection.
Python
17
star
46

PythonOpenModule

Open python modules on sys.path and open folders in window
Python
16
star
47

PowershellUtils

Run powershell commands from within Sublime Text.
Python
15
star
48

Rake

Sublime Text 2 plugin for Ruby Rake
Python
15
star
49

JumpTo

Sublime Text plugin to move (multiple) cursors
Python
13
star
50

YamlPipelines

Sublime Syntax Definitions for YAML CI/CD pipelines like GitHub Actions, AzureDevops, Kong API Gateway, Gitlab, Bitbucket etc.
Python
12
star
51

SublimeCMD

Simple command processor for Sublime Text.
Python
12
star
52

AutoSelect

Sticky Selection
Python
12
star
53

syntax-test-action

Github Action to run syntax tests
Shell
12
star
54

SwitchWindow

A plugin to quickly switch between Sublime Text windows via Command Palette
Python
11
star
55

ScopeNamingGuidelines

Collection of documents for scope naming guidelines in Sublime Text syntax definitions
11
star
56

Terminal

Launch terminals from the current file or the root project folder
Python
11
star
57

Sublime-Snipt

Sublime Text 2 plugin that will sync with snipt.net
Python
10
star
58

OpenDefaultApplication

Sublime Text plugin to open files in the system default application
Python
10
star
59

sublimetext.github.io

GitHub Organization for Open-Source Sublime Text Package Development
9
star
60

AutoProjects

A Sublime Text plugin to open folders as projects
Python
8
star
61

PackageTesting

Minimal testing framework for Sublime Text packages. (beta)
Python
8
star
62

TJ3-syntax-sublimetext2

Taskjuggler 3 syntax and code snippets for Sublime Text 2
7
star
63

WslBuild

A Sublime Text package to create build systems running in WSL2
Python
6
star
64

Astro

Astro syntax for Sublime Text
Astro
6
star
65

LINQPad

Syntax highlighting and build system for LINQPad scripts
5
star
66

AlpineJS

AlpineJS syntax for Sublime Text
PHP
4
star
67

Ceedling

Sublime Text plugin for Ceedling C unit testing framework
Python
4
star
68

Less

Less syntax for Sublime Text
Less
4
star
69

Gaelyk

Gaelyk Sublime Text Package
3
star
70

GoToEndOfLineOrScope

Sublime Text plugin to bind a key (for example the end key) to move/extend the cursor/selection(s) to the end of the line, or to before the specified scope (i.e. a comment) at the end of the line
Python
3
star
71

RichTextFormat

Syntax definition for RTF files in Sublime Text 3
2
star
72

wbond-packages

Packages created, and (mostly) managed by Will Bond
1
star
73

OpenFileInCurrentFolder

Allows opening of files in the same folder as the active view
Python
1
star