Menu

1 / 2

How to setup tree-sitter highlighters and parsers for Neovim

DEV Community·Neo Sahadeo·6 months ago
#iiWGem0G
#neovim#lua#treesitter#software#nvim
Reading 0:00
15s threshold

If you're reading this, you're probably trying to figure out how to move on after the travesty that was Apr 3, 2026 for nvim-treesitter.

This post will be a walk through on how to setup syntax highlighting for tree-sitter.

Prerequisites:

You will need the tree-sitter cli

Setting up Queries

Queries are the languages that contain the .scm files required to tell tree-sitter how to highlight code.

The easiest way to install this is to make the queries directory in you nvim path, e.g. ~/.config/nvim/queries

After which clone the nvim tree-sitter repo and move the queries folder into the nvim/queries dir.

1.1 clone --depth=1 https://github.com/nvim-treesitter/nvim-treesitter

1.2 mv nvim-treesitter/runtime/queries ~/.config/nvim/

That should be that, most syntax should immediately work.

If certain files like .svelte are not working, you can try forcing tree-sitter to start. I'll use an autocommand to attach a callback during file type loads.

~/.config/nvim/init.lua

vim . api .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.