treetags

Crates.iotreetags
lib.rstreetags
version0.2.2
created_at2025-03-27 12:41:41.096627+00
updated_at2025-09-01 07:03:08.370668+00
descriptionGenerate vi compatible tags for multiple languages
homepage
repositoryhttps://github.com/jha-naman/treetags
max_upload_size
id1607895
size210,843
Jha Naman (jha-naman)

documentation

README

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 for most languages to make it easier to support multiple languages and keep the program trivially easy to maintain.

Refer to this issue to see how tags compare to LSP.

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

Full support with extension fields

  • Go
  • Rust

Basic navigation support without extension fields

  • Bash/Sh
  • C
  • C++
  • C#
  • Elixir
  • Haskell
  • Java
  • JavaScript
  • Julia
  • Lua
  • Ocaml
  • PHP
  • Python
  • Ruby
  • Scala

Installation

Install Rust and C developmet toolchains to build treetags

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

Recommended Usage

While it is fine to manually invoke treetags to generate tags file for a project, the recommended way is to use the gutentags plugin to manage the tags file. There is a nice write-up on setting up gutentags here, which can be useful for setting things up.

You will have to configure gutentags to use treetags as the tags generator at a minimum in your vim/nvim configuration file.

let g:gutentags_ctags_executable = 'treetags'

Or, if you are using lua for configuration

vim.g.gutentags_ctags_executable = 'treetags'

Running Integration Tests

Integration tests are built from test cases on demand

cargo build  # Generates test files
cargo test   # Runs all tests including generated ones

Usage

Use the --help option to see supported command line arguments.

$ 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:
  ... # Options omitted for brevity
Commit count: 45

cargo fmt