Skip to main content

TreeSitter

nvim-treesitter

Treesitter is a new parser generator tool that we can use in Neovim to power faster and more accurate syntax highlighting.

opts = {
-- LazyVim config for treesitter
indent = { enable = true }, ---@type lazyvim.TSFeat
highlight = { enable = true }, ---@type lazyvim.TSFeat
folds = { enable = true }, ---@type lazyvim.TSFeat
ensure_installed = {
"bash",
"c",
"diff",
"html",
"javascript",
"jsdoc",
"json",
"jsonc",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"printf",
"python",
"query",
"regex",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"xml",
"yaml",
},
}

nvim-treesitter-textobjects

opts = {
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
-- LazyVim extention to create buffer-local keymaps
keys = {
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" },
},
},
}

nvim-ts-autotag

Automatically add closing tags for HTML and JSX

opts = {}