romus204/tree-sitter-manager.nvim

github github
syntax
stars 201
issues 6
subscribers 8
forks 8
CREATED

UPDATED


tree-sitter-manager.nvim

A lightweight Tree-sitter parser manager for Neovim.

Why this plugin?

Although Neovim 0.12 integrated Tree-sitter into the core, it still lacks a built-in parser installer. With nvim-treesitter/nvim-treesitter now archived, this plugin provides a lightweight, actively maintained alternative that makes installing parsers and adding new languages effortless.

tree-sitter-manager.nvim provides a minimal alternative for:

  • Installing and removing Tree-sitter parsers
  • Automatically copying queries for syntax highlighting
  • Managing parsers through a clean TUI interface

Features

  • Install parsers directly from Tree-sitter repositories
  • Dynamic FileType autocmd registration for installed parsers
  • Works with any plugin manager (lazy, packer, vim-plug, native packages)
  • Custom/fork repositories: Override any language or add new ones via setup()
  • Repository queries: Use use_repo_queries to use query files bundled in the grammar repo itself

Requirements

Mandatory

  • Neovim 0.12+
  • tree-sitter CLI
  • git (for cloning parser repositories)
  • C compiler (gcc/clang for building parsers)

Optional

  • Nerd Font (for proper display of icons ✅❌📦)

Installation

lazy.nvim

{
  "romus204/tree-sitter-manager.nvim",
  dependencies = {}, -- tree-sitter CLI must be installed system-wide
  config = function()
    require("tree-sitter-manager").setup({
      -- ensure_installed = { "bash", "lua", "python" }, -- list of parsers to install automatically
      -- Optional: custom paths
      -- parser_dir = vim.fn.stdpath("data") .. "/site/parser",
      -- query_dir = vim.fn.stdpath("data") .. "/site/queries",
    })
  end
}

Custom / Fork Repositories

You can override built-in language definitions or add entirely new ones via the languages option in setup(). This keeps repos.lua clean — no changes to the plugin repository are needed.

Override a built-in language with a fork

require("tree-sitter-manager").setup({
  languages = {
    cpp = {
      install_info = {
        url = "https://github.com/myfork/tree-sitter-cpp",
        revision = "abc1234",
        -- Use the query files that ship with the forked repo instead of
        -- the bundled queries. The parser's queries/ directory is copied
        -- automatically during installation.
        use_repo_queries = true,
      },
    },
  },
})

Add a language not in the built-in list

require("tree-sitter-manager").setup({
  languages = {
    mylang = {
      install_info = {
        url = "https://github.com/someone/tree-sitter-mylang",
        use_repo_queries = true, -- copy queries/ from the cloned repo
      },
    },
  },
})

use_repo_queries behaviour

Value Query source
false (default) Queries bundled in runtime/queries/<lang>/ of this plugin
true queries/ directory inside the cloned grammar repository

If use_repo_queries = true but the repo has no queries/ directory, a warning is shown and the plugin falls back to the bundled queries automatically.

Treesitter Highlighting

Treesitter highlighting is enabled by default. If you prefer to use standard regex highlighting for specific languages, use the nohighlight option.

require("tree-sitter-manager").setup({
  -- Use regex highlighting for these languages
  nohighlight = { "yaml", "zsh" },
})

Alternatively, if you prefer an "opt-in" approach, use the highlight option.

require("tree-sitter-manager").setup({
  -- Only enable treesitter highlighting for these languages
  highlight = { "lua", "c" },

  -- Disable treesitter highlighting
  -- highlight = {},
})

Usage

:TSManager - Open the parser management interface

Keybindings

i - Install parser under cursor
x - Remove parser under cursor
u - Update parser under cursor
r - Refresh installation status
q / <Esc> - Close window

Queries

Syntax highlighting queries (highlights.scm, injections.scm, etc.) were sourced from the archived nvim-treesitter repository and placed in runtime/queries/.

Parser Repository Links

Parser repository URLs in repos.lua are sourced from the archived nvim-treesitter repository.

[!WARNING] These links are provided as-is. Due to the large number of parsers, each URL cannot be manually verified for current availability or compatibility. If you encounter a broken link, outdated revision, or build failure, please:

Your contributions help keep this plugin reliable for everyone.

Known Limitations

  • Unix-first development: Primarily tested on macOS/Linux. Windows support may require additional testing.
  • Requires tree-sitter CLI: Ensure tree-sitter is available in your $PATH.
  • No auto-updates: To update a parser, update it manually (u) or remove (x) and reinstall (i) it.

Contributing

Pull requests are welcome! Especially for:

  • Adding new languages to repos.lua
  • UI/UX improvements
  • Bug fixes