Skip to content

romus204/tree-sitter-manager.nvim

Repository files navigation

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()
  end,
}

vim.pack

vim.pack.add {
  { src = "https://github.com/romus204/tree-sitter-manager.nvim" }
}

require("tree-sitter-manager").setup()

Default Options

require("tree-sitter-manager").setup({
  -- Default Options
  parser_dir = vim.fn.stdpath("data") .. "/site/parser",
  query_dir = vim.fn.stdpath("data") .. "/site/queries",
  assume_installed = {}, -- blacklist languages
  ensure_installed = {}, -- parsers to install at startup
  border = "rounded", -- border style for the TUI window
  auto_install = false, -- auto-install when a new filetype is encountered
  noauto_install = {}, -- blacklist from auto_install
  highlight = true, -- enable treesitter highlighting (use list to whitelist)
  nohighlight = {}, -- blacklist from highlight
  languages = {}, -- override or add new parser sources
  nerdfont = true, -- use Nerd Font icons in the manager UI
})

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",
        queries = "queries/subdir", -- override the default "queries" source directory
        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.

The default queries/ directory can be changed by means of the optional queries field.

Automatic Installation

You can automatically install missing parsers upon editing a new file by setting auto_install = true. To opt-out of some languages, while auto-install is enabled, use the noauto_install option.

require("tree-sitter-manager").setup({
  auto_install = true,
  -- Use built-in Neovim treesitter parsers
  noauto_install = {
    "c", "lua", "markdown", "markdown_inline", "query", "vim", "vimdoc"
  },
})

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
:TSInstall - Install parsers provided as arguments
:TSUninstall - Uninstall parsers

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

About

A lightweight Tree-sitter parser manager for Neovim.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors