install(languages, opts)
Download, compile, and install the specified treesitter parsers and copy the corresponding queries to a directory onruntimepath, enabling their use in Neovim.
This operation is performed asynchronously by default. For synchronous operation (e.g., in a bootstrapping script), you need to
wait() for it.Parameters
Language(s) to install. Can be:
- A single language name (e.g.,
"rust") - An array of language names (e.g.,
{ "rust", "javascript", "python" }) - A tier name:
"stable","unstable","unmaintained", or"all"(not recommended)
"all" installs all available parsers.Installation options
Returns
Returns
true if all installations were successful, false otherwise.Note: This function returns an awaitable object when called asynchronously.Usage
Basic Installation
Synchronous Installation
For bootstrapping scripts or when you need to wait for installation to complete:Force Reinstall
Generate from Grammar
Install with Summary
Installation Process
The install function performs these steps for each language:- Download: Fetches the parser source from the configured repository (usually GitHub)
- Extract: Unpacks the tarball to a temporary cache directory
- Generate (optional): Runs
tree-sitter generateif requested or required - Compile: Builds the parser using
tree-sitter build - Install: Copies the compiled parser to the installation directory
- Queries: Links or copies query files to make them available to Neovim
The function automatically handles parser dependencies. If a parser requires other parsers, they will be installed automatically.
Requirements
curl- for downloading parser sourcestar- for extracting archivestree-sitterCLI - for compiling parsers (and optionally generating from grammar)- A C compiler - used by tree-sitter for compilation
See Also
- update() - Update installed parsers to latest versions
- uninstall() - Remove installed parsers
- get_available() - List available parsers