commit b5d491c41e7f0e095f8aa4115429c137dd4dbf9d
parent 6746dc97e79ef3b20415caa88b1daba518d42f0e
Author: Alex Balgavy <alexander.balgavy@spaceapplications.com>
Date: Fri, 1 Aug 2025 15:45:11 +0200
nvim: mappings
Diffstat:
3 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/nvim/lua/mappings.lua b/nvim/lua/mappings.lua
@@ -3,16 +3,22 @@ local map = function(keys, func, desc, mode)
vim.keymap.set(mode, keys, func, { desc = desc })
end
local diag = vim.diagnostic
+
-- Diagnostic keymaps
map('[d', function() diag.jump({ count = -1, float = true }) end, 'Previous diagnostic')
map(']d', function() diag.jump({ count = 1, float = true }) end, 'Next diagnostic')
-
map('[e', function()
diag.jump({ count = -1, float = true, severity = diag.severity.ERROR })
end, 'Previous error')
map(']e', function()
diag.jump({ count = 1, float = true, severity = diag.severity.ERROR })
end, 'Next error')
+map('[e', function()
+ diag.jump({ count = -1, float = true, severity = diag.severity.WARN })
+end, 'Previous warning')
+map(']e', function()
+ diag.jump({ count = 1, float = true, severity = diag.severity.WARN })
+end, 'Next warning')
map('<leader>e', diag.open_float, 'Show errors')
map('<leader>q', function() diag.setloclist({ severity = diag.severity.ERROR }) end, 'Errors to quickfix')
diff --git a/nvim/lua/plugins/gitsigns.lua b/nvim/lua/plugins/gitsigns.lua
@@ -10,8 +10,8 @@ return
changedelete = { text = '~' },
},
on_attach = function()
- vim.keymap.set('n', ']c', function() require('gitsigns').next_hunk() end, { buffer = true })
- vim.keymap.set('n', '[c', function() require('gitsigns').prev_hunk() end, { buffer = true })
+ vim.keymap.set('n', ']g', function() require('gitsigns').nav_hunk('next') end, { buffer = true })
+ vim.keymap.set('n', '[g', function() require('gitsigns').nav_hunk('prev') end, { buffer = true })
vim.keymap.set('n', ']=', function() require('gitsigns').toggle_deleted() end, { buffer = true })
vim.keymap.set('n', ']~', function() require('gitsigns').diffthis() end, { buffer = true })
vim.keymap.set('n', ']-', function() require('gitsigns').preview_hunk() end, { buffer = true })
diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua
@@ -33,22 +33,10 @@ local config = function()
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',
- },
+ 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" },
},
swap = {
enable = true,