Skip to main content
nvim-treesitter

What is nvim-treesitter?

The nvim-treesitter plugin provides three core capabilities for Neovim:
  1. Parser management: Functions for installing, updating, and removing Tree-sitter parsers for over 300 programming languages
  2. Query collections: Curated sets of queries that enable Tree-sitter features built into Neovim (highlighting, folding, indentation, injections)
  3. Experimental features: A staging ground for Tree-sitter-based functionality considered for upstreaming to Neovim core
This plugin focuses on parser and query management. The actual Tree-sitter features (like syntax highlighting) are built into Neovim itself.

Why use nvim-treesitter?

Tree-sitter provides several advantages over traditional regex-based syntax:
  • Accurate parsing: Tree-sitter builds a complete syntax tree, understanding your code’s structure
  • Performance: Incremental parsing means only changed portions are re-parsed
  • Consistency: The same parser powers highlighting, navigation, text objects, and more
  • Language support: Over 300 languages with actively maintained parsers

Key capabilities

Syntax highlighting

Enable Tree-sitter-based syntax highlighting for rich, accurate code coloring

Code folding

Fold code blocks intelligently based on syntax structure

Indentation

Experimental Tree-sitter-based automatic indentation

Language injections

Support for multi-language documents like Markdown with code blocks

Quick example

Here’s how to install parsers and enable highlighting:
-- Install parsers for your languages
require('nvim-treesitter').install({ 'rust', 'javascript', 'python' })

-- Enable highlighting for specific filetypes
vim.api.nvim_create_autocmd('FileType', {
  pattern = { 'rust', 'javascript', 'python' },
  callback = function()
    vim.treesitter.start()
  end,
})

Requirements

Before installing nvim-treesitter, ensure you have:
  • Neovim 0.11.0 or later (nightly builds are supported)
  • tar and curl in your PATH for downloading parsers
  • tree-sitter-cli version 0.26.1 or later
  • A C compiler for building parsers from source
The support policy covers only the latest stable and nightly releases of Neovim. Compatibility with older versions is not guaranteed.

Supported languages

The plugin supports parsers for over 300 languages, organized into tiers:
  • Stable: Follow semantic versioning for updates
  • Unstable: Track the HEAD of the parser repository
  • Unmaintained: No automatic updates available
  • Unsupported: Known to be broken
For each language, nvim-treesitter may provide queries for:
  • Highlights
  • Folds
  • Indents
  • Injections (language injections)
  • Locals (definitions and references)
Check the supported languages list to see which features are available for your language.

What’s next?

Quickstart

Get up and running in under 5 minutes

Installation

Detailed installation instructions for all package managers

Configuration

Learn about setup options and customization

Commands

Reference for all available commands