2024-08-06 16:35:29 +02:00
|
|
|
-- Diagnostic keymaps
|
|
|
|
|
|
|
|
vim.keymap.set(
|
|
|
|
'n',
|
|
|
|
'[d',
|
|
|
|
vim.diagnostic.goto_prev,
|
2024-08-13 07:29:57 +02:00
|
|
|
{ desc = "[Diagnostic] Go to previous diagnostic message" }
|
2024-08-06 16:35:29 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
vim.keymap.set(
|
|
|
|
'n',
|
|
|
|
']d',
|
|
|
|
vim.diagnostic.goto_next,
|
2024-08-13 07:29:57 +02:00
|
|
|
{ desc = "[Diagnostic] Go to next diagnostic message" }
|
2024-08-06 16:35:29 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
vim.keymap.set(
|
|
|
|
'n',
|
|
|
|
'<leader>e',
|
|
|
|
vim.diagnostic.open_float,
|
2024-08-13 07:29:57 +02:00
|
|
|
{ desc = "[Diagnostic] Open floating diagnostic message" }
|
2024-08-06 16:35:29 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
vim.keymap.set(
|
|
|
|
'n',
|
|
|
|
'<leader>q',
|
|
|
|
vim.diagnostic.setloclist,
|
2024-08-13 07:29:57 +02:00
|
|
|
{ desc = "[Diagnostic] Open diagnostics list" }
|
2024-08-06 16:35:29 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
-- Install and configure treesitter
|
|
|
|
|
|
|
|
return {
|
|
|
|
"nvim-treesitter/nvim-treesitter",
|
|
|
|
dependencies = {
|
|
|
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
|
|
|
},
|
|
|
|
build = ":TSUpdate",
|
|
|
|
|
|
|
|
-- Configure treesitter
|
|
|
|
config = function()
|
2024-10-04 13:56:39 +02:00
|
|
|
---@diagnostic disable-next-line: missing-fields
|
2024-08-06 16:35:29 +02:00
|
|
|
local config = require("nvim-treesitter.configs")
|
|
|
|
|
|
|
|
config.setup({
|
|
|
|
-- Enable color syntax
|
|
|
|
highlight = {
|
|
|
|
enable = true,
|
2024-10-03 07:38:41 +02:00
|
|
|
disable = {
|
|
|
|
"markdown"
|
|
|
|
},
|
2024-08-06 16:35:29 +02:00
|
|
|
},
|
|
|
|
-- Enable better indentation management
|
|
|
|
indent = { enable = true },
|
|
|
|
|
|
|
|
-- Installed and configured languages
|
|
|
|
ensure_installed = {
|
|
|
|
"bash",
|
2024-10-04 13:56:39 +02:00
|
|
|
"css",
|
2024-08-06 16:35:29 +02:00
|
|
|
"dot",
|
|
|
|
"gitignore",
|
|
|
|
"html",
|
2024-10-04 13:56:39 +02:00
|
|
|
"javascript",
|
2024-08-06 16:35:29 +02:00
|
|
|
"json",
|
2024-10-04 13:56:39 +02:00
|
|
|
"julia",
|
2024-08-06 16:35:29 +02:00
|
|
|
"latex",
|
|
|
|
"lua",
|
2024-10-04 13:56:39 +02:00
|
|
|
"markdown",
|
|
|
|
"markdown_inline",
|
|
|
|
"mermaid",
|
|
|
|
"norg",
|
2024-08-06 16:35:29 +02:00
|
|
|
"python",
|
2024-10-04 13:56:39 +02:00
|
|
|
"query",
|
|
|
|
"r",
|
|
|
|
"typescript",
|
2024-08-06 16:35:29 +02:00
|
|
|
"vim",
|
2024-10-04 13:56:39 +02:00
|
|
|
"vimdoc",
|
2024-08-06 16:35:29 +02:00
|
|
|
"yaml",
|
|
|
|
},
|
|
|
|
|
|
|
|
-- Do not install parses synchronously
|
|
|
|
sync_install = false,
|
|
|
|
|
|
|
|
-- Do not install automatically missing parsers
|
|
|
|
auto_install = false,
|
|
|
|
|
|
|
|
-- <Ctrl-space> select the current bloc
|
|
|
|
incremental_selection = {
|
|
|
|
enable = true,
|
|
|
|
keymaps = {
|
|
|
|
init_selection = "<C-space>",
|
|
|
|
node_incremental = "<C-space>",
|
|
|
|
scope_incremental = false,
|
|
|
|
node_decremental = "<bs>",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
textobjects = {
|
|
|
|
select = {
|
|
|
|
enable = true,
|
|
|
|
lookahead = true, -- Automatically jump forward to textobj
|
|
|
|
keymaps = {
|
|
|
|
-- You can use the capture groups defined in textobjects.scm
|
|
|
|
['aa'] = '@parameter.outer',
|
|
|
|
['ia'] = '@parameter.inner',
|
|
|
|
['af'] = '@function.outer',
|
|
|
|
['if'] = '@function.inner',
|
|
|
|
['ac'] = '@class.outer',
|
|
|
|
['ic'] = '@class.inner',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
move = {
|
|
|
|
enable = true,
|
|
|
|
set_jumps = true, -- whether to set jumps in the jumplist
|
|
|
|
goto_next_start = {
|
|
|
|
[']m'] = '@function.outer',
|
|
|
|
[']]'] = '@class.outer',
|
|
|
|
},
|
|
|
|
goto_next_end = {
|
|
|
|
[']M'] = '@function.outer',
|
|
|
|
[']['] = '@class.outer',
|
|
|
|
},
|
|
|
|
goto_previous_start = {
|
|
|
|
['[m'] = '@function.outer',
|
|
|
|
['[['] = '@class.outer',
|
|
|
|
},
|
|
|
|
goto_previous_end = {
|
|
|
|
['[M'] = '@function.outer',
|
|
|
|
['[]'] = '@class.outer',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
swap = {
|
|
|
|
enable = true,
|
|
|
|
swap_next = {
|
|
|
|
['<leader>a'] = '@parameter.inner',
|
|
|
|
},
|
|
|
|
swap_previous = {
|
|
|
|
['<leader>A'] = '@parameter.inner',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
}
|