~keving/dotfiles

54d4cf2d3b60156dd0b73d66f970226a466d1eb1 — Kevin Guillaumond 2 months ago 3ca136c
Add mapping for git hunks
1 files changed, 14 insertions(+), 0 deletions(-)

M .config/nvim/init.lua
M .config/nvim/init.lua => .config/nvim/init.lua +14 -0
@@ 62,6 62,20 @@ require('gitsigns').setup()

-- Plugin configs

-- Gitsigns
utils.map('n', ']h', '<cmd>Gitsigns next_hunk<CR>', {silent=true})
utils.map('n', '[h', '<cmd>Gitsigns prev_hunk<CR>', {silent=true})
utils.map('n', '<leader>hs', ':Gitsigns stage_hunk<CR>')
utils.map('v', '<leader>hs', ':Gitsigns stage_hunk<CR>')
utils.map('n', '<leader>hr', ':Gitsigns reset_hunk<CR>')
utils.map('v', '<leader>hr', ':Gitsigns reset_hunk<CR>')
utils.map('n', '<leader>hS', '<cmd>Gitsigns stage_buffer<CR>')
utils.map('n', '<leader>hu', '<cmd>Gitsigns undo_stage_hunk<CR>')
utils.map('n', '<leader>hR', '<cmd>Gitsigns reset_buffer<CR>')
utils.map('n', '<leader>hp', '<cmd>Gitsigns preview_hunk<CR>')
utils.map('n', '<leader>hb', '<cmd>lua require"gitsigns".blame_line{full=true}<CR>')
utils.map('n', '<leader>hp', ':Gitsigns preview_hunk<CR>', {silent = true})

-- NERDTree
-- Shortcut to open NERDTree
utils.map('n', '<leader>ne', ':NERDTreeToggle<Enter>')