Skip to main content

setup(opts)

Configure installation options for nvim-treesitter. This function should be called before any installation operations if you want to customize the installation directory.
You only need to call setup() if you want to set non-default options. The plugin works out of the box with sensible defaults.

Parameters

opts
table
Configuration options table

Returns

This function does not return a value.

Usage

require('nvim-treesitter').setup {
  -- Install parsers to a custom directory
  install_dir = "/some/path/to/store/parsers",
}

Default Configuration

By default, parsers and queries are installed to:
vim.fn.stdpath('data') .. '/site'

Implementation Details

The setup function performs the following operations:
  1. Normalizes the provided install_dir path
  2. Prepends the directory to Neovim’s runtimepath
  3. Merges user configuration with default settings using deep extend
The install_dir must be set before calling any installation functions like install(), update(), or uninstall().