#language #tags #treetags

bin+lib treetags

Generate vi compatible tags for multiple languages

2 releases

new 0.1.1 Mar 28, 2025
0.1.0 Mar 27, 2025

#2384 in Command line utilities

35 downloads per month

MIT license

39KB
572 lines

TreeTags

Generate vi compatible tags for multiple languages.

Uses the tags queries defined in the various official language parsers to detect tags.

The goal is to have code navigation available in vim/nvim for multiple languages with minimum effort and have reasonable performance. Extension Fields support is missing by design to make it easier to support multiple languages and keep the program trivially easy to maintain.

By default, it will generate a new tag file in the current directory and look for tags recursively in the current directory and its children. If the --append option is used, it will look for a tag file in the current directory or any of its parent directories, and update the tag file if it exists with tags generated from the list of files passed via command line.

Supported Languages

  • C
  • C++
  • Elixir
  • Go
  • Java
  • JavaScript
  • Lua
  • Ocaml
  • PHP
  • Python
  • Ruby
  • Rust

Installation

Install Rust and C developmet toolchains to build treetags

cargo build --release
cp target/release/treetags /somewhere/in/the/PATH/

Usage

$ target/release/treetags --help
Generate vi compatible tags for multiple languages

Usage: treetags [OPTIONS] [FILE_NAMES]...

Arguments:
  [FILE_NAMES]...  List of file names to be processed when `--append` option is passed

Options:
  -f <TAG_FILE>            Name to be used for the tagfile, should not contain path separator [default: tags]
      --append             Append tags to existing tag file instead of reginerating the file from scratch.
                           Need to pass in list of file names for which new tags are to be generated.
                           Will panic if the tag file doesn't already exist in current or one of the parent
                           directories.
      --workers <WORKERS>  Number of threads to use for parsing files [default: 4]
      --exclude <EXCLUDE>  Files/directories matching the pattern will not be used while generating tags
      --options <OPTIONS>  Value passed in this arg is currently being ignored.
                           Kept for compatibility with `vim-gutentags` plugin. [default: ]
  -h, --help               Print help```

Dependencies

~202MB
~6M SLoC