129 lines
2.6 KiB
Lua
129 lines
2.6 KiB
Lua
-- Diagnostic keymaps
|
|
|
|
vim.keymap.set(
|
|
'n',
|
|
'[d',
|
|
vim.diagnostic.goto_prev,
|
|
{ desc = 'Go to previous diagnostic message' }
|
|
)
|
|
|
|
vim.keymap.set(
|
|
'n',
|
|
']d',
|
|
vim.diagnostic.goto_next,
|
|
{ desc = 'Go to next diagnostic message' }
|
|
)
|
|
|
|
vim.keymap.set(
|
|
'n',
|
|
'<leader>e',
|
|
vim.diagnostic.open_float,
|
|
{ desc = 'Open floating diagnostic message' }
|
|
)
|
|
|
|
vim.keymap.set(
|
|
'n',
|
|
'<leader>q',
|
|
vim.diagnostic.setloclist,
|
|
{ desc = 'Open diagnostics list' }
|
|
)
|
|
|
|
-- Install and configure treesitter
|
|
|
|
return {
|
|
"nvim-treesitter/nvim-treesitter",
|
|
dependencies = {
|
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
|
},
|
|
build = ":TSUpdate",
|
|
|
|
-- Configure treesitter
|
|
config = function()
|
|
local config = require("nvim-treesitter.configs")
|
|
|
|
config.setup({
|
|
-- Enable color syntax
|
|
highlight = {
|
|
enable = true,
|
|
},
|
|
-- Enable better indentation management
|
|
indent = { enable = true },
|
|
|
|
-- Installed and configured languages
|
|
ensure_installed = {
|
|
"bash",
|
|
"gitignore",
|
|
"html",
|
|
"json",
|
|
"lua",
|
|
"markdown",
|
|
"markdown_inline",
|
|
"python",
|
|
"vim",
|
|
"yaml",
|
|
},
|
|
|
|
-- Do not install parses synchronously
|
|
sync_install = false,
|
|
|
|
-- lorse de l'appui sur <Ctrl-space> sélectionne le bloc
|
|
-- courant spécifique au langage de programmation
|
|
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,
|
|
}
|
|
|
|
|