This plugin provides functions for installing, updating, and removing tree-sitter parsers.
tar
and curl
in your path (or alternatively git
)tree-sitter
CLI (0.22.6 or later)require('pckr').add({
{ 'nvim-treesitter/nvim-treesitter',
branch = 'main',
config_pre = function()
vim.g.loaded_nvim_treesitter = 1
end
},
{ 'lewis6991/ts-install.nvim',
requires = 'nvim-treesitter/nvim-treesitter',
-- OPTIONAL
config = function()
require('ts-install').setup({
ensure_install = {
'lua',
'c',
'bash',
-- etc
},
})
end
},
})
require('lazy').setup(
{ 'nvim-treesitter/nvim-treesitter',
branch = 'main',
init = function()
vim.g.loaded_nvim_treesitter = 1
end,
},
{ 'lewis6991/ts-install.nvim',
-- OPTIONAL
config = function()
require('ts-install').setup({
ensure_install = {
'lua',
'c',
'bash',
-- etc
},
})
end
}
)
ts-install.nvim
can be optionally configured by calling setup()
.
The following snippet lists the available options and their default values.
require'ts-install'.setup {
ensure_install = { },
-- List of parsers to ignore installing
ignore_install = { },
-- Automatically install missing parsers when entering buffer
auto_install = false,
-- Directory to install parsers and queries to
install_dir = vim.fn.stdpath('data') .. '/ts-install'
}
Check :h ts-install-commands
for a list of all available commands.
The scope of nvim-treesitter is too large and aims to both support the query and parser information for a vast amount of languages, in addition to the installation and parser management functionality.
The goal of this plugin is to only provide the latter in a more opinionated way. Specifically a way to install parsers and their queries from variouse sources (currently only nvim-treesitter).