Skip to main content

uninstall(languages, opts)

Remove the parser and queries for the specified language(s). This deletes both the compiled parser library and the associated query files from the installation directory.
This operation is destructive and cannot be undone. The parser and queries will need to be reinstalled if needed again.

Parameters

languages
string|string[]
required
Language(s) to uninstall. Can be:
  • A single language name (e.g., "rust")
  • An array of language names (e.g., { "rust", "javascript" })
  • A tier name: "stable", "unstable", or "all" to uninstall all parsers
Only parsers installed via nvim-treesitter will be uninstalled.
opts
table
Uninstall options

Returns

This function does not return a value (returns nil).
This function is asynchronous but does not return an awaitable object like install() and update().

Usage

Uninstall a Single Parser

require('nvim-treesitter').uninstall('rust')

Uninstall Multiple Parsers

require('nvim-treesitter').uninstall({ 'rust', 'javascript', 'python' })

Uninstall All Parsers

require('nvim-treesitter').uninstall('all')

Uninstall with Summary

require('nvim-treesitter').uninstall(
  { 'lua', 'vim', 'python' },
  { summary = true }
)

Uninstall Process

For each language, the function:
  1. Verify: Checks if the parser is managed by nvim-treesitter
  2. Remove Parser: Deletes the compiled parser library (.so file) from the parser/ directory
  3. Remove Queries: Deletes query files from the queries/ directory (handles both symlinks and regular directories)
  4. Cleanup: Removes parser metadata from parser-info/

Behavior Details

  • Parser dependencies are not automatically uninstalled (to prevent breaking other parsers that might depend on them)
  • If a parser is not found or not managed by nvim-treesitter, a warning is logged
  • Query directories are handled differently based on their type:
    • Symlinks: Simply unlinked
    • Directories: Recursively removed with all contents
Only parsers installed in nvim-treesitter’s configured installation directory are affected. Parsers installed system-wide or via other methods are ignored.

Verification

To check which parsers are managed by nvim-treesitter and can be uninstalled:
local installed = require('nvim-treesitter').get_installed()
print(vim.inspect(installed))
Parsers installed from other sources or placed anywhere else on runtimepath will not be listed by get_installed() and cannot be uninstalled via this function.

Warnings

You’ll see a warning if you try to uninstall a parser that is:
  • Not installed
  • Not managed by nvim-treesitter
  • Installed from a different source
Example warning message:
Parser for <language> is not managed by nvim-treesitter

See Also