aboutsummaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/init.lua b/init.lua
index ad993ea..ea330eb 100644
--- a/init.lua
+++ b/init.lua
@@ -124,9 +124,20 @@ require('lazy').setup({
changedelete = { text = '~' },
},
on_attach = function(bufnr)
- vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
- vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
- vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
+ vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' })
+
+ -- don't override the built-in and fugitive keymaps
+ local gs = package.loaded.gitsigns
+ vim.keymap.set({'n', 'v'}, ']c', function()
+ if vim.wo.diff then return ']c' end
+ vim.schedule(function() gs.next_hunk() end)
+ return '<Ignore>'
+ end, {expr=true, buffer = bufnr, desc = "Jump to next hunk"})
+ vim.keymap.set({'n', 'v'}, '[c', function()
+ if vim.wo.diff then return '[c' end
+ vim.schedule(function() gs.prev_hunk() end)
+ return '<Ignore>'
+ end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"})
end,
},
},
@@ -308,6 +319,7 @@ vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
+vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]resume' })
-- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter`
@@ -403,7 +415,7 @@ local on_attach = function(_, bufnr)
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
- nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
+ nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')