Treetags - Generate Vi compatible tags for multiple languages
Introduction
Treetags aims to be a reliable and easy
to maintain way to generate Vi compatible tags file for several popular languages.
The primary motivation for writing this was to get go to definition
functionality
working in vim/neovim for multiple languages without requiring any setup or
dependencies for each individual language.
Currently, it’s in an early development stage and may have issues detecting and
generating all expected tags. Bug reports for any issues are appreciated.
Treetags leverages treesitter which makes it straightforward to support multiple languages. Treetags does not generate additional optional fields1 that are supported by most of the current ctags successors. This is by design to eliminate the need to write custom code for each of the supported languages.
Parity with Universal Ctags in terms of features and performance is not a goal for this project to keep it simple and easy to maintain.
Content
Supported Languages
- C
- C++
- Elixir
- Go
- Java
- JavaScript
- Lua
- Ocaml
- PHP
- Python
- Ruby
- Rust
Installation
Pre-built binaries for the program are available for Linux and macOS on github.
Those who have Rust and C tool chains installed can use cargo to install
# cargo install treetags
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.2.
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'