Files
LazyVim/lua/lazyvim/plugins/treesitter.lua

52 lines
1.3 KiB
Lua

return {
{
"nvim-treesitter/nvim-treesitter",
version = false, -- last release is way too old and doesn't work on Windows
build = ":TSUpdate",
event = "BufReadPost",
keys = {
{ "<c-space>", desc = "Increment selection" },
{ "<bs>", desc = "Schrink selection", mode = "x" },
},
---@type TSConfig
opts = {
highlight = { enable = true },
indent = { enable = true },
context_commentstring = { enable = true, enable_autocmd = false },
ensure_installed = {
"bash",
"help",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"yaml",
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = "<nop>",
node_decremental = "<bs>",
},
},
},
---@param opts TSConfig
config = function(plugin, opts)
if plugin.ensure_installed then
require("lazyvim.util").deprecate("treesitter.ensure_installed", "treesitter.opts.ensure_installed")
end
require("nvim-treesitter.configs").setup(opts)
end,
},
}