dotfiles/nvim/lua/plugins/treesitter.lua

53 lines
1.4 KiB
Lua

return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
opts = {
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
ensure_installed = "all",
ignore_install = { "gdhsader", "phpdoc" },
indent = { enable = true },
auto_install = true,
sync_install = true,
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
textobjects = {
select = { enable = true, lookahead = true },
move = {
enable = true,
goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", ["]a"] = "@parameter.inner" },
goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer", ["]A"] = "@parameter.inner" },
goto_previous_start = {
["[f"] = "@function.outer",
["[c"] = "@class.outer",
["[a"] = "@parameter.inner",
},
goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer", ["[A"] = "@parameter.inner" },
},
},
},
build = function()
require("nvim-treesitter.install").update({ with_sync = true })()
end,
dependencies = {
{ "nvim-treesitter/nvim-treesitter-textobjects" },
{
"nvim-treesitter/nvim-treesitter-context",
opts = {
enable = true,
mode = "topline",
line_numbers = true,
},
},
{ "windwp/nvim-ts-autotag" },
},
}