summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorLuiz Antonio Calliari Filho <luizcalliari.filho@protonmail.com>2023-02-26 23:03:34 -0300
committerLuiz Antonio Calliari Filho <luizcalliari.filho@protonmail.com>2023-02-26 23:03:34 -0300
commit187bebcbf93a82c29f12d946136b8d35ab695c64 (patch)
tree804aa94c305a94c03038d2e6a0655a5b880db73e /init.lua
parent72364ad9acb35bb44d7e0af64f977f2a4b3c59db (diff)
Adding [+c and ]+c to move to diffs and leader+ph to show a pop up with the preview diff value.
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index aeca6d2..427af75 100644
--- a/init.lua
+++ b/init.lua
@@ -109,6 +109,19 @@ require('lazy').setup({
topdelete = { text = '‾' },
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>')
+ end
},
},