CTags

CTags support for Sublime Text 2/3

  • 所有者: SublimeText/CTags
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

=====
CTags

.. image:: https://travis-ci.org/SublimeText/CTags.svg?branch=development
:target: https://travis-ci.org/SublimeText/CTags

About

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

.. _Sublime Text 2/3: http://sublimetext.com/
.. _Exuberant CTags: http://ctags.sourceforge.net/

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.

.. _forum thread: http://www.sublimetext.com/forum/viewtopic.php?f=5&t=144

Installation

The easiest way to install this plugin, is to use the Package Control_
plugin, by Will Bond_

.. _Package Control: http://wbond.net/sublime_packages/package_control/
.. _Will Bond: http://wbond.net/

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:

  • Using Homebrew_::

    brew install ctags

  • Using MacPorts_::

    port install ctags

.. _Homebrew: http://mxcl.github.com/homebrew/
.. _MacPorts: http://www.macports.org/

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.

.. _CTags binary: http://prdownloads.sourceforge.net/ctags/ctags58.zip

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[^\t]+)\t'
    '(?P[^\t]+)\t'
    '(?P<ex_command>.?);"\t'
    '(?P[^\t\r\n]+)'
    '(?:\t(?P.
    ))?'

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

.. _open an issue: https://github.com/SublimeText/CTags/issues

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

主要指标

概览
名称与所有者SublimeText/CTags
主编程语言Python
编程语言Python (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2011-06-26 01:12:01
推送于2024-01-18 18:55:23
最后一次提交2024-01-17 18:59:34
发布数18
最新版本名称0.6.1 (发布于 )
第一版名称0.3.0 (发布于 )
用户参与
星数1k
关注者数77
派生数164
提交数366
已启用问题?
问题数255
打开的问题数37
拉请求数74
打开的拉请求数2
关闭的拉请求数24
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?