dotfiles/.config/nvim/lua/plugins/treesitter.lua

46 lines
1 KiB
Lua

return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = { "BufReadPre", "BufNewFile" },
lazy = vim.fn.argc(-1) == 0,
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },
keys = {
{ "<c-space>", desc = "Increment Selection" },
{ "<bs>", desc = "Decrement Selection", mode = "x" },
},
opts_extend = { "ensure_installed" },
---@type TSConfig
---@diagnostic disable-next-line: missing-fields
opts = {
highlight = { enable = true },
indent = { enable = true },
ensure_installed = {
"bash",
"c",
"diff",
"html",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"vim",
"vimdoc",
"yaml"
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
}
}