Convert Figma logo to code with AI

universal-ctags logoctags

A maintained ctags implementation

6,825
635
6,825
239

Top Related Projects

54,157

ripgrep recursively searches directories for a regex pattern while respecting your gitignore

38,497

A simple, fast and user-friendly alternative to 'find'

72,492

:cherry_blossom: A command-line fuzzy finder

A code-searching tool similar to ack, but faster.

3,083

:mag: A simple, fast fuzzy finder for the terminal

an Emacs "jump to definition" package for 50+ languages

Quick Overview

Universal Ctags is a maintained, multilanguage reimplementation of the Unix ctags program. It generates an index (or tag) file of language objects found in source files for many popular programming languages. This index allows these items to be quickly and easily located by a text editor or other utility.

Pros

  • Supports a wide range of programming languages and file formats
  • Actively maintained and regularly updated
  • Highly configurable and extensible
  • Improved parsing and tag generation compared to traditional ctags

Cons

  • Can be complex to set up and configure for advanced use cases
  • May have performance issues with very large codebases
  • Some less common languages or newer language features may have limited support
  • Learning curve for utilizing all features and options

Getting Started

  1. Install Universal Ctags:

    • On macOS: brew install universal-ctags
    • On Ubuntu: sudo apt-get install universal-ctags
    • On Windows: Download from the releases page
  2. Generate tags for a project:

    cd /path/to/your/project
    ctags -R .
    
  3. Use the generated tags file with your text editor or IDE. For example, in Vim:

    :set tags=/path/to/your/project/tags
    
  4. Navigate to a tag:

    • In Vim: Place cursor on a symbol and press Ctrl-]
    • In other editors: Consult your editor's documentation for tag navigation

For more advanced usage and configuration options, refer to the Universal Ctags documentation.

Competitor Comparisons

54,157

ripgrep recursively searches directories for a regex pattern while respecting your gitignore

Pros of ripgrep

  • Significantly faster search performance, especially for large codebases
  • Respects .gitignore rules by default, improving search relevance
  • Built-in support for various file types and encoding

Cons of ripgrep

  • Limited to searching file contents, doesn't generate tags for code navigation
  • Lacks advanced language-specific parsing capabilities
  • Not designed for generating comprehensive code structure information

Code comparison

ripgrep (searching for "function" in JavaScript files):

rg -t js 'function'

ctags (generating tags for JavaScript files):

ctags -R --languages=javascript

Key differences

ripgrep is primarily a fast, modern search tool designed for quickly finding text patterns in source code and other files. It excels at rapid content searches across large codebases.

ctags, on the other hand, is a source code indexing tool that generates tag files for efficient code navigation and structure analysis. It provides deeper language-specific parsing and symbol extraction capabilities.

While both tools are valuable for developers, they serve different purposes: ripgrep for quick content searches, and ctags for code structure analysis and navigation support in editors and IDEs.

38,497

A simple, fast and user-friendly alternative to 'find'

Pros of fd

  • Faster and more user-friendly alternative to the traditional find command
  • Colorized output and smart case sensitivity by default
  • Supports regular expressions and parallel command execution

Cons of fd

  • Limited to file and directory search, lacking the tag generation capabilities of ctags
  • May not be as widely available on systems as ctags
  • Fewer language-specific features compared to ctags' extensive language support

Code Comparison

fd example:

fd -e txt

ctags example:

ctags -R --languages=python

While fd focuses on efficient file searching, ctags is primarily used for generating tags files for source code navigation. The code examples demonstrate their different use cases: fd for finding files with a specific extension, and ctags for creating tags for Python files in a project.

fd excels in quick file searches and offers a more modern, user-friendly interface. However, ctags provides deeper integration with programming languages and text editors for code navigation and symbol lookup. The choice between the two depends on whether you need fast file searching (fd) or advanced code navigation capabilities (ctags).

72,492

:cherry_blossom: A command-line fuzzy finder

Pros of fzf

  • Versatile fuzzy finder for command-line and vim integration
  • Fast and efficient search capabilities across various data sources
  • Highly customizable with extensive options and color schemes

Cons of fzf

  • Limited to searching and filtering; doesn't generate tags or provide code navigation
  • Requires additional setup for advanced use cases in development environments
  • May have a steeper learning curve for non-command-line users

Code comparison

fzf example (command-line usage):

find . -type f | fzf

ctags example (generating tags):

ctags -R .

Key differences

  • Purpose: fzf is a general-purpose fuzzy finder, while ctags generates tag files for code navigation
  • Functionality: fzf excels at interactive searching, while ctags focuses on static code analysis
  • Integration: fzf integrates well with shell environments, while ctags is primarily used with text editors and IDEs
  • Performance: fzf is optimized for real-time searching, while ctags processes entire codebases to generate tag files

Use cases

  • fzf: Quick file searching, command history navigation, and interactive filtering
  • ctags: Code navigation, symbol lookup, and integration with development tools

Both tools serve different purposes and can be complementary in a developer's toolkit, with fzf enhancing command-line productivity and ctags improving code navigation and understanding.

A code-searching tool similar to ack, but faster.

Pros of The Silver Searcher

  • Faster search performance, especially for large codebases
  • Ignores files specified in .gitignore by default
  • Supports searching compressed files

Cons of The Silver Searcher

  • Limited to text search functionality
  • Doesn't generate tags for code navigation
  • Less language-specific features compared to Ctags

Code Comparison

The Silver Searcher (ag):

ag "function" --js

Ctags:

ctags -R --languages=javascript

The Silver Searcher focuses on fast text searching across files, while Ctags generates tags for code navigation and structure analysis. The Silver Searcher is ideal for quickly finding text patterns in large codebases, whereas Ctags excels at creating a structural overview of the codebase for IDE integration and navigation.

The Silver Searcher is more user-friendly for simple text searches, with built-in file ignoring and colorized output. Ctags, on the other hand, provides more detailed language-specific parsing and tag generation, which is crucial for advanced code navigation and analysis tools.

While both tools serve different primary purposes, they can be complementary in a developer's toolkit. The Silver Searcher is excellent for rapid content searches, while Ctags is essential for creating a navigable structure of the codebase, especially useful in IDEs and text editors that support tag-based navigation.

3,083

:mag: A simple, fast fuzzy finder for the terminal

Pros of fzy

  • Lightweight and fast fuzzy finder, optimized for performance
  • Simple and easy to use, with a minimalistic approach
  • Can be easily integrated into other tools and workflows

Cons of fzy

  • Limited functionality compared to ctags, focusing only on fuzzy finding
  • Lacks advanced features for code navigation and symbol indexing
  • Smaller community and fewer extensions/plugins available

Code comparison

fzy (main fuzzy matching function):

int match(const char *needle, const char *haystack) {
    while (*needle && *haystack) {
        if (tolower(*needle) == tolower(*haystack++))
            needle++;
    }
    return *needle == '\0';
}

ctags (example of tag generation):

static void makeCTag (const tagEntryInfo *const tag)
{
    if (! tag->placeholder)
    {
        int length = 0;
        char *line = NULL;
        tagWriter *writer = getWriter();

        length = writer->writeEntry (writer, tag, &line);
        if (length > 0)
            writeTagLine (line, length);
        eFree (line);
    }
}

Summary

fzy is a lightweight fuzzy finder optimized for speed and simplicity, while ctags is a more comprehensive tool for generating tags from source code. fzy excels in quick fuzzy matching tasks, whereas ctags provides advanced code navigation and symbol indexing capabilities. The choice between the two depends on the specific needs of the project and the desired functionality.

an Emacs "jump to definition" package for 50+ languages

Pros of dumb-jump

  • Simpler setup and usage, requiring minimal configuration
  • Language-agnostic approach, supporting many languages out of the box
  • Faster for quick, on-the-fly code navigation within a project

Cons of dumb-jump

  • Less accurate for complex codebases or large projects
  • Limited functionality compared to ctags' extensive features
  • May produce more false positives in certain scenarios

Code Comparison

dumb-jump:

(use-package dumb-jump
  :bind (("M-g o" . dumb-jump-go-other-window)
         ("M-g j" . dumb-jump-go)
         ("M-g i" . dumb-jump-go-prompt)
         ("M-g x" . dumb-jump-go-prefer-external)
         ("M-g z" . dumb-jump-go-prefer-external-other-window))
  :config (setq dumb-jump-selector 'ivy))

ctags:

ctags -R --languages=python,javascript,c,cpp .

dumb-jump offers a more straightforward setup within Emacs, while ctags requires generating tag files for each project. ctags provides more precise results and extensive customization options, making it better suited for large, complex projects. dumb-jump excels in quick, language-agnostic code navigation, ideal for smaller projects or rapid development. The choice between the two depends on project size, complexity, and specific requirements for code navigation and analysis.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Universal Ctags

Coverity Scan Build Status Coverage Status Build status RTD build status CircleCI Build Status GitHub Actions/VALGRIND Gurubase

Universal Ctags (abbreviated as u-ctags) is a maintained implementation of ctags. ctags generates an index (or tag) file of language objects found in source files for programming languages. This index makes it easy for text editors and other tools to locate the indexed items.

Exuberant Ctags (e-ctags) maintained by Darren Hiebert, the ancestor of Universal Ctags, improved traditional ctags with multi-language support, the ability for the user to define new languages searched by regular expressions (called optlib in Universal Ctags), and the ability to generate emacs-style TAGS files. But the activity of the project unfortunately stalled.

Universal Ctags has the objective of continuing the development of Exuberant Ctags. Reza Jelveh reza.jelveh@gmail.com initially created a personal fork of Exuberant Ctags on GitHub. As interest and participation grew, it was decided to move development to a dedicated project as Universal Ctags. The goal of this project is to maintain a common/unified working space where people interested in making ctags better can work together.

Some of the major features of Universal Ctags are:

  • more numbers of improved language support
    • new extended C/C++ language parser, etc.
  • fully extended optlib (a feature to define a new language parser from a command line)
  • interactive mode (experimental)

The latest build and package

If you want to try the latest Universal Ctags without building it yourself...

Windows

Daily builds are available at the ctags-win32 project. Go to the releases page to download zip packages.

Unix-like

Nightly builds are available at the ctags-nightly-build project. Go to the releases page to download tarball archives.

Mac

Recent builds are available via the universal-ctags Homebrew formula.

Snap

Go to ctags-snap and clone the ctags-snap repo. Then, follow instructions to build the snap package of Universal Ctags. Snapcraft will automatically fetch the source code from GitHub.

How to build and install

To build with Autotools (Autoconf and Automake) on GNU/Linux, OSX, or Windows 10 WSL,

    $ git clone https://github.com/universal-ctags/ctags.git
    $ cd ctags
    $ ./autogen.sh
    $ ./configure  # use --prefix=/where/you/want to override installation directory, defaults to /usr/local
    $ make
    $ make install # may require extra privileges depending on where to install

GNU make is assumed as the make command.

See docs/autotools.rst for more information.

To build on Windows, see docs/windows.rst for more information.

To build on OSX, see docs/osx.rst for more information.

Manual

The primary documents of Universal Ctags are man pages. Users should first consult the ctags(1), and other man pages if necessary.

Universal Ctags Hacking Guide, which also includes the man pages, is primarily for developers and provides additional information to the man pages, including experimental features.

See also */README.md on this repository.

Differences from exuberant-ctags

You may be interested in how Universal Ctags is different from Exuberant Ctags. See ctags-incompatibilities(7) and Introduced changes for details.

The most significant incompatible changes:

  • Universal Ctags doesn't load ~/.ctags and ./.ctags at starting up time. Instead, it loads ~/.ctags.d/*.ctags and ./.ctags.d/*.ctags.

  • Universal Ctags is more strict about characters that can be used in kind letters and kind names than Exuberant-ctags.

    • The letter must be an alphabetical character ([a-zA-EG-Z]). F is reserved for file kind.

    • The first character of the name must be alphabetic, and the rest characters must be alphanumeric ([a-zA-Z][a-zA-Z0-9]*).

    The detailed background is explained in #1737.

    If you want to reuse your .ctags written for Exuberant-ctags, you must review kind letters and names defined with --regex-<LANG>=... options. When updating the definitions, using --kinddef-<LANG>=... option is appreciated.

CVE-2022-4515

It is not affected to Universal Ctags. It was fixed in e00c55d7a0204dc1d0ae316141323959e1e16162 in 2016. Thanks to the reporter.

Pull-requests are welcome!