Neovim Treesitter without the nvim-treesitter plugin

2026-04-19

Yapping

I very much like using Neovim but it is not without problems. The features of neovim are often developed with a external, quasi official plugin like nvim-lspconfig and nvim-treesitter. So, to use these features fully I will have to install some external packages.

There’s package managers that manage plugins, that’s perfectly reasonable.

But wait, there’s more. Package managers for lsp servers, package managers for tree-sitter parsers and queries, package managers for stuff that doesn’t fall into any of them. And there’s packages to work with all those package managers, it’s genuinely a huge mess.

This introduces too many uncertainties. My system is now cluttered with code that does literally the same thing, not to mention that there isn’t any version pining for most of them, and it doesn’t support less used systems like FreeBSD.

The last straw to make me switch away from these plugins / sub-package managers is that recently the nvim-treesitter plugin just shut down due to maintainence pressure (aka. some guy just walked up and said some un-nice things to the dev, the dev didn’t deserve any of this, but it happens in OSS), and, in search of alternatives, I’ve come across this absolutely based blog here: neovim-config-without-plugins-2025

I completely agree with this person on the motive to use a bare minimum nvim configuration. It’s what I’ve been doing for years.

However, their / his / her article uses luarocks to manage the dependencies. Since I don’t want yet another package manager, here I will explain how I use treesitter without the nvim-treesitter plugin but with my system’s package manager and upstream data.

The Problem

as mentioned in the blog, Neovim already has tree-sitter support. It is able to parse the code, properly highlight them and enable other plugins to do tree-sitter queries.

But tree-sitter is not only the client. It needs:

This is exactly where nvim-treesitter comes in. How they do it is simple:

How to install manually

On Gentoo linux, the parser can be installed directly, there’s packages like dev-libs/tree-sitter-rust.

Parsers

But for now, it only installs the parser to /usr/lib64/libtree-sitter-rust.so.15.0, so we need to link it so make nvim recognize:

mkdir -p ~/.local/share/nvim/site/parser
cd $_
ln -s /usr/lib64/libtree-sitter-rust.so rust.so

(see :h treesitter-parsers)

Some plugins like matchup that use their own queries will work now.

But to enable tree-sitter highlighting, we need to install query files.

Query files

There are multiple source to get them:

Installation is simple, just copy the queries folder to the queries/<lang> folder under nvim’s runtimepath:

git clone --depth=1 https://github.com/tree-sitter/tree-sitter-rust
mkdir -p ~/.local/share/nvim/site/queries
ln -s <tree-sitter-rust repo>/queries rust

To enable treesitter-based highlighting, add this to your config

-- Minimal treesitter setup
vim.api.nvim_create_autocmd("FileType", {
    callback = function(ev)
        pcall(vim.treesitter.start, ev.buf)
    end
})

(see :h treesitter-query and :h vim.treesitter.start())

Run :checkhealth vim.treesitter, and it’s done. I honestly didn’t expect it to be that simple.


(This is the latest article.)How to enable march=native and -flto on gentoo-kernel >