96 lines
2.3 KiB
Lua
96 lines
2.3 KiB
Lua
return {
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
dependencies = {
|
|
"JoosepAlviste/nvim-ts-context-commentstring",
|
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
|
},
|
|
config = function(_, opts)
|
|
require("nvim-treesitter.configs").setup(opts)
|
|
|
|
-- enable MDX markdown
|
|
vim.filetype.add { extension = { mdx = "mdx" } }
|
|
local ft_to_parser = require("nvim-treesitter.parsers").filetype_to_parsername
|
|
ft_to_parser.mdx = "markdown"
|
|
end,
|
|
opts = {
|
|
ensure_installed = {
|
|
"vim",
|
|
"lua",
|
|
"vimdoc",
|
|
"html",
|
|
"css",
|
|
"rust",
|
|
"regex",
|
|
"javascript",
|
|
"typescript",
|
|
"tsx",
|
|
"solidity",
|
|
"toml",
|
|
"bash",
|
|
"markdown",
|
|
"markdown_inline",
|
|
"json",
|
|
"elixir",
|
|
"erlang",
|
|
"eex",
|
|
"kdl",
|
|
"yuck",
|
|
"sql",
|
|
"typst",
|
|
},
|
|
incremental_selection = {
|
|
enable = true,
|
|
keymaps = {
|
|
init_selection = "<C-space>",
|
|
node_incremental = "<C-space>",
|
|
scope_incremental = "<nop>",
|
|
node_decremental = "<bs>",
|
|
},
|
|
},
|
|
highlight = { enable = true },
|
|
textobjects = {
|
|
lsp_interop = {
|
|
enable = true,
|
|
peek_definition_code = {
|
|
["df"] = "@function.outer",
|
|
["dc"] = "@class.outer",
|
|
},
|
|
},
|
|
select = {
|
|
enable = true,
|
|
lookahead = true,
|
|
keymaps = {
|
|
["af"] = "@function.outer",
|
|
["if"] = "@function.inner",
|
|
["ac"] = "@function.outer",
|
|
["ic"] = "@function.inner",
|
|
["ae"] = "@block.outer",
|
|
["ie"] = "@block.inner",
|
|
["as"] = "@statement.outer",
|
|
["is"] = "@statement.inner",
|
|
["am"] = "@call.outer",
|
|
["im"] = "@call.inner",
|
|
},
|
|
},
|
|
move = {
|
|
enable = true,
|
|
set_jumps = true,
|
|
goto_next_start = {
|
|
["]m"] = "@function.outer",
|
|
},
|
|
goto_next_end = {
|
|
["]M"] = "@function.outer",
|
|
},
|
|
goto_previous_start = {
|
|
["[m"] = "@function.outer",
|
|
},
|
|
goto_previous_end = {
|
|
["[M"] = "@function.outer",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|