nvim-config/lua/plugins/treesitter.lua

83 lines
2.5 KiB
Lua

return {
{
"nvim-treesitter/nvim-treesitter",
branch = "master",
build = ":TSUpdate",
lazy = false,
event = {
"BufReadPost",
"BufNewFile",
},
dependencies = {
{ "nvim-treesitter/nvim-treesitter-textobjects" },
},
keys = {
{ "<C-Space>", desc = "Increment selection" },
{ "<bs>", desc = "Decrement selection", mode = "x" },
},
cmd = { "TSUpdateSync" },
config = function()
require("nvim-treesitter.configs").setup({
sync_install = false,
auto_install = true,
ensure_installed = {
"bash",
"fish",
"c",
"html",
"fish",
"javascript",
"json",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"query",
"regex",
"tsx",
"typescript",
"vim",
"vimdoc",
"yaml",
"dockerfile",
"http",
"go",
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-Space>",
node_incremental = "<C-Space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
disable = { "go" },
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
},
})
end,
},
{
"nvim-treesitter/playground",
},
}