2024-04-23 04:34:15 +02:00
|
|
|
return {
|
|
|
|
-- treesitter
|
|
|
|
{
|
|
|
|
"nvim-treesitter/nvim-treesitter",
|
|
|
|
version = false,
|
|
|
|
event = { "BufReadPre", "BufNewFile" },
|
|
|
|
build = ":TSUpdate",
|
|
|
|
dependencies = {
|
|
|
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
|
|
|
{
|
|
|
|
"windwp/nvim-ts-autotag",
|
|
|
|
opts = {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
config = function()
|
|
|
|
local treesitter = require("nvim-treesitter.configs")
|
|
|
|
treesitter.setup({
|
|
|
|
highlight = { enable = true, disable = { "latex" } },
|
|
|
|
indent = { enable = true },
|
|
|
|
ensure_installed = {
|
|
|
|
"bash",
|
|
|
|
"html",
|
|
|
|
"css",
|
|
|
|
"javascript",
|
|
|
|
"lua",
|
|
|
|
"python",
|
|
|
|
"vim",
|
|
|
|
"vimdoc",
|
|
|
|
"yaml",
|
|
|
|
"json",
|
|
|
|
"c",
|
|
|
|
"cpp",
|
|
|
|
"go",
|
|
|
|
"rust",
|
|
|
|
"regex",
|
|
|
|
"latex",
|
|
|
|
"bibtex"
|
|
|
|
},
|
|
|
|
incremental_selection = {
|
|
|
|
enable = true,
|
|
|
|
keymaps = {
|
|
|
|
init_selection = "<C-space>",
|
|
|
|
node_incremental = "<C-space>",
|
|
|
|
scope_incremental = "<c-s>",
|
|
|
|
node_decremental = "<M-space>",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
textobjects = {
|
|
|
|
move = {
|
|
|
|
enable = true,
|
|
|
|
goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer" },
|
|
|
|
goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer" },
|
|
|
|
goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer" },
|
|
|
|
goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
|
|
|
|
-- mini.ai
|
|
|
|
{
|
|
|
|
"echasnovski/mini.ai",
|
|
|
|
-- keys = {
|
|
|
|
-- { "a", mode = { "x", "o" } },
|
|
|
|
-- { "i", mode = { "x", "o" } },
|
|
|
|
-- },
|
|
|
|
event = "VeryLazy",
|
|
|
|
opts = function()
|
|
|
|
local ai = require("mini.ai")
|
|
|
|
return {
|
|
|
|
n_lines = 500,
|
|
|
|
custom_textobjects = {
|
|
|
|
o = ai.gen_spec.treesitter({
|
|
|
|
a = { "@block.outer", "@conditional.outer", "@loop.outer" },
|
|
|
|
i = { "@block.inner", "@conditional.inner", "@loop.inner" },
|
|
|
|
}, {}),
|
|
|
|
f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}),
|
|
|
|
c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}),
|
|
|
|
t = { "<([%p%w]-)%f[^<%w][^<>]->.-</%1>", "^<.->().*()</[^/]->$" },
|
|
|
|
d = { "%f[%d]%d+" }, -- digits
|
2024-06-25 13:52:46 +02:00
|
|
|
e = { -- Word with case
|
2024-04-23 04:34:15 +02:00
|
|
|
{
|
|
|
|
"%u[%l%d]+%f[^%l%d]",
|
|
|
|
"%f[%S][%l%d]+%f[^%l%d]",
|
|
|
|
"%f[%P][%l%d]+%f[^%l%d]",
|
|
|
|
"^[%l%d]+%f[^%l%d]",
|
|
|
|
},
|
|
|
|
"^().*()$",
|
|
|
|
},
|
|
|
|
g = function() -- Whole buffer, similar to `gg` and 'G' motion
|
|
|
|
local from = { line = 1, col = 1 }
|
|
|
|
local to = {
|
|
|
|
line = vim.fn.line("$"),
|
|
|
|
col = math.max(vim.fn.getline("$"):len(), 1),
|
|
|
|
}
|
|
|
|
return { from = from, to = to }
|
|
|
|
end,
|
2024-06-25 13:52:46 +02:00
|
|
|
u = ai.gen_spec.function_call(), -- u for "Usage"
|
2024-04-23 04:34:15 +02:00
|
|
|
U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }), -- without dot in function name
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
}
|