2023-03-14 20:57:07 +01:00
|
|
|
local env = require("my.helpers.env")
|
|
|
|
|
2023-01-10 02:38:06 +01:00
|
|
|
local M = {
|
2023-03-14 20:57:07 +01:00
|
|
|
{
|
|
|
|
"nvim-treesitter/nvim-treesitter",
|
|
|
|
build = ":TSUpdate",
|
|
|
|
event = "BufReadPost",
|
|
|
|
dependencies = {
|
|
|
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
|
|
|
},
|
|
|
|
config = function()
|
|
|
|
require("nvim-treesitter.configs").setup({
|
|
|
|
--{{{Languages
|
|
|
|
ensure_installed = {
|
|
|
|
"bash",
|
|
|
|
"c",
|
|
|
|
"cpp",
|
|
|
|
"css",
|
|
|
|
"dockerfile",
|
|
|
|
"elixir",
|
|
|
|
"fish",
|
|
|
|
"html",
|
2023-09-08 19:49:18 +02:00
|
|
|
"javascript",
|
2023-03-14 20:57:07 +01:00
|
|
|
"json",
|
|
|
|
"jsonc",
|
|
|
|
"latex",
|
2023-09-08 19:49:18 +02:00
|
|
|
"lua",
|
|
|
|
"markdown",
|
|
|
|
"markdown_inline",
|
|
|
|
"nix",
|
2023-03-14 20:57:07 +01:00
|
|
|
"python",
|
|
|
|
"rust",
|
|
|
|
"scss",
|
|
|
|
"toml",
|
|
|
|
"tsx",
|
2023-09-08 19:49:18 +02:00
|
|
|
"typescript",
|
2023-03-14 20:57:07 +01:00
|
|
|
"vim",
|
|
|
|
"yaml",
|
2023-01-10 02:38:06 +01:00
|
|
|
},
|
2023-03-14 20:57:07 +01:00
|
|
|
sync_install = false,
|
|
|
|
--}}}
|
|
|
|
--{{{ Highlighting
|
|
|
|
highlight = {
|
2023-01-10 02:38:06 +01:00
|
|
|
enable = true,
|
2023-03-14 20:57:07 +01:00
|
|
|
disable = { "kotlin" },
|
|
|
|
additional_vim_regex_highlighting = false,
|
2023-01-10 02:38:06 +01:00
|
|
|
},
|
|
|
|
--}}}
|
2023-03-14 20:57:07 +01:00
|
|
|
textobjects = {
|
|
|
|
--{{{ Select
|
|
|
|
select = {
|
|
|
|
enable = true,
|
|
|
|
lookahead = true,
|
|
|
|
keymaps = {
|
|
|
|
-- You can use the capture groups defined in textobjects.scm
|
|
|
|
["af"] = "@function.outer",
|
|
|
|
["if"] = "@function.inner",
|
|
|
|
["ac"] = "@class.outer",
|
|
|
|
["ic"] = "@class.inner",
|
|
|
|
},
|
2023-01-10 02:38:06 +01:00
|
|
|
},
|
2023-03-14 20:57:07 +01:00
|
|
|
--}}}
|
|
|
|
--{{{ Move
|
|
|
|
move = {
|
|
|
|
enable = true,
|
|
|
|
set_jumps = true, -- whether to set jumps in the jumplist
|
|
|
|
goto_next_start = {
|
|
|
|
["]f"] = "@function.outer",
|
2023-11-10 17:28:14 +01:00
|
|
|
["]t"] = "@class.outer",
|
2023-03-14 20:57:07 +01:00
|
|
|
},
|
|
|
|
goto_next_end = {
|
|
|
|
["]F"] = "@function.outer",
|
2023-11-10 17:28:14 +01:00
|
|
|
["]T"] = "@class.outer",
|
2023-03-14 20:57:07 +01:00
|
|
|
},
|
|
|
|
goto_previous_start = {
|
|
|
|
["[f"] = "@function.outer",
|
2023-11-10 17:28:14 +01:00
|
|
|
["[t"] = "@class.outer",
|
2023-03-14 20:57:07 +01:00
|
|
|
},
|
|
|
|
goto_previous_end = {
|
|
|
|
["[F"] = "@function.outer",
|
2023-11-10 17:28:14 +01:00
|
|
|
["[T"] = "@class.outer",
|
2023-03-14 20:57:07 +01:00
|
|
|
},
|
2023-01-10 02:38:06 +01:00
|
|
|
},
|
2023-03-14 20:57:07 +01:00
|
|
|
--}}}
|
2023-01-10 02:38:06 +01:00
|
|
|
},
|
2023-03-14 20:57:07 +01:00
|
|
|
indent = { enable = true },
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
-- show context on closing parenthesis
|
|
|
|
"haringsrob/nvim_context_vt",
|
|
|
|
event = "BufReadPost",
|
|
|
|
cond = env.vscode.not_active(),
|
|
|
|
},
|
2023-08-19 21:13:34 +02:00
|
|
|
{
|
|
|
|
-- show context at top of file
|
|
|
|
"nvim-treesitter/nvim-treesitter-context",
|
|
|
|
event = "BufReadPost",
|
|
|
|
cond = env.vscode.not_active(),
|
|
|
|
opts = { enable = true },
|
|
|
|
},
|
2023-01-10 02:38:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return M
|