Skip to main content
Parsers are the core of tree-sitter functionality. This guide covers how to manage parser installation, updates, and removal.

Installing Parsers

Install Specific Languages

To install parsers for specific languages:
require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' })
The install() function runs asynchronously by default and returns immediately.

Using Commands

You can also use Ex commands:
:TSInstall rust javascript zig

Install Multiple Languages

require('nvim-treesitter').install({
  'lua',
  'python', 
  'javascript',
  'typescript',
  'rust',
  'go'
})

Install by Tier

Parsers are organized into tiers based on stability:
  • Tier 1 (stable): Track versioned releases
  • Tier 2 (unstable): Track latest commits
  • Tier 3 (unmaintained): No active maintenance
  • Tier 4 (unsupported): Not recommended
" Install all stable parsers
:TSInstall stable

" Install all unstable parsers
:TSInstall unstable

Install All Available Parsers

Installing all parsers can take significant time and disk space.
require('nvim-treesitter').install('all')
Or via command:
:TSInstall all

Updating Parsers

Update Specific Parsers

Update one or more parsers:
require('nvim-treesitter').update({ 'rust', 'lua' })
Or via command:
:TSUpdate rust lua

Update All Installed Parsers

require('nvim-treesitter').update()
Or via command:
:TSUpdate
Running :TSUpdate with no arguments updates all installed parsers.

How Updates Work

When you update a parser, nvim-treesitter:
  1. Checks the installed revision against the target revision
  2. Downloads the source code if an update is available
  3. Compiles the parser using tree-sitter build
  4. Installs the compiled .so file
  5. Updates or links query files
Parsers are only updated if the revision has changed.

Uninstalling Parsers

Uninstall Specific Parsers

require('nvim-treesitter').uninstall({ 'rust', 'zig' })
Or via command:
:TSUninstall rust zig

Uninstall All Parsers

This removes all parsers managed by nvim-treesitter.
require('nvim-treesitter').uninstall('all')
Or via command:
:TSUninstall all

Advanced Installation Options

Force Reinstall

Force reinstallation even if the parser is already installed:
require('nvim-treesitter').install(
  { 'rust', 'lua' },
  { force = true }
)
This is useful when:
  • A parser installation failed previously
  • You want to recompile with new compiler flags
  • Query files need to be regenerated

Generate from Grammar

Some parsers don’t include a pre-generated src/parser.c. Force generation:
require('nvim-treesitter').install(
  { 'zimbu' },
  { generate = true }
)
Generating parsers requires tree-sitter-cli (0.26.1 or later) in your PATH.

Control Parallelism

By default, up to 100 parsers can install concurrently. Adjust this:
require('nvim-treesitter').install(
  { 'rust', 'lua', 'python', 'go' },
  { max_jobs = 4 }
)

Show Installation Summary

require('nvim-treesitter').install(
  'all',
  { summary = true }
)
This displays a message like: Installed 45/50 languages

Synchronous Installation

For scripts or bootstrapping, wait for installation to complete:
-- Wait up to 5 minutes for installation
local success = require('nvim-treesitter').install({
  'rust',
  'javascript',
  'zig'
}):wait(300000)

if success then
  print('All parsers installed successfully')
else
  print('Some parsers failed to install')
end
1

Call install()

The function returns a handle that can be waited on.
2

Call :wait(timeout)

Specify timeout in milliseconds. The call blocks until completion or timeout.
3

Check return value

Returns true if all parsers installed successfully.

Checking Installation Status

List All Available Parsers

:TSInstallInfo
This shows all parsers with their installation status.

Check Installed Parsers Programmatically

local installed = require('nvim-treesitter.config').get_installed()
vim.print(installed)  -- { 'lua', 'python', 'rust', ... }

Check Available Parsers

local available = require('nvim-treesitter.config').get_available()
vim.print(available)  -- All parsers in nvim-treesitter

Check Parsers by Tier

-- Get only tier 1 (stable) parsers
local stable = require('nvim-treesitter.config').get_available(1)

-- Get only tier 2 (unstable) parsers  
local unstable = require('nvim-treesitter.config').get_available(2)

Parser Versioning

nvim-treesitter is only guaranteed to work with specific parser versions specified in the plugin’s parsers.lua manifest.
Each parser entry in lua/nvim-treesitter/parsers.lua specifies:
rust = {
  install_info = {
    url = 'https://github.com/tree-sitter/tree-sitter-rust',
    revision = 'v0.21.0',  -- Pinned version
  },
  maintainers = { '@amaanq' },
  tier = 1,
}
When you run :TSUpdate, parsers are updated to their pinned revision.

Installation Directories

Parsers are installed to directories within install_dir:
install_dir/
├── parser/              # Compiled .so files
│   ├── lua.so
│   ├── python.so
│   └── rust.so
├── queries/             # Query files (symlinked or copied)
│   ├── lua/
│   ├── python/
│   └── rust/
└── parser-info/         # Revision tracking
    ├── lua.revision
    ├── python.revision
    └── rust.revision

Troubleshooting

Installation Fails

  1. Check you have required tools: tar, curl, tree-sitter, C compiler
  2. Run :checkhealth nvim-treesitter
  3. Check install logs: :messages
  4. Try force reinstall: :TSInstall! <language>

Parser Compilation Errors

Ensure your C compiler is compatible. See cc crate requirements.
# Test your compiler
cc --version

# Test tree-sitter CLI
tree-sitter --version

Wrong Parser Version

-- Force update to correct revision
require('nvim-treesitter').update({ 'rust' }, { force = true })

Clean Install

To completely reinstall all parsers:
1

Uninstall all parsers

:TSUninstall all
2

Clear cache

rm -rf ~/.cache/nvim/tree-sitter
3

Reinstall

:TSInstall lua python rust

Automation

Auto-update on Plugin Update

With lazy.nvim:
{
  'nvim-treesitter/nvim-treesitter',
  lazy = false,
  build = ':TSUpdate'  -- Runs automatically on plugin update
}

Auto-install Missing Parsers

init.lua
-- Install parsers for languages you commonly use
vim.api.nvim_create_autocmd('VimEnter', {
  callback = function()
    local langs = { 'lua', 'python', 'rust', 'javascript' }
    require('nvim-treesitter').install(langs)
  end,
})

Next Steps