summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Antonio Calliari Filho <luizcalliari.filho@protonmail.com>2023-03-06 23:26:20 -0300
committerLuiz Antonio Calliari Filho <luizcalliari.filho@protonmail.com>2023-03-06 23:26:20 -0300
commit66dc5b896d47ed58e9821b8b39588ce431bfd83a (patch)
treea2e6e90926e846fa8020296d542d3e13945ad080
parent187bebcbf93a82c29f12d946136b8d35ab695c64 (diff)
Feat: Simplifying code
-rw-r--r--init.lua14
1 files changed, 3 insertions, 11 deletions
diff --git a/init.lua b/init.lua
index 427af75..9ce29c6 100644
--- a/init.lua
+++ b/init.lua
@@ -110,17 +110,9 @@ require('lazy').setup({
changedelete = { text = '~' },
},
on_attach = function(bufnr)
- local function map(mode, lhs, rhs, opts)
- opts = vim.tbl_extend('force', {noremap = true, silent = true}, opts or {})
- vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts)
- end
-
- -- Navigation
- map('n', ']c', "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'", {expr=true})
- map('n', '[c', "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'", {expr=true})
-
- -- Actions
- map('n', '<leader>ph', '<cmd>Gitsigns preview_hunk<CR>')
+ vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to [P]revious [H]unk' })
+ vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to [N]ext [H]unk' })
+ vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
end
},
},