From b4ca3831b0b753a7bd6ffafac80b6727fb24bd75 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 14 Mar 2024 01:41:40 +0000 Subject: [PATCH] Update gitsigns keymaps --- CHANGELOG.md | 4 ++++ after/plugin/gitsigns.lua | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 205f3a9..9c7cb91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ * Add `committia.vim` to improve the commit buffer when running `git commit`. +### Changed + +* Update `gitsigns` keymaps to use `g` as the prefix for keymaps instead of `h` - e.g. `gb` to `git blame` the current line. + ## 12th March 2024 ### Added diff --git a/after/plugin/gitsigns.lua b/after/plugin/gitsigns.lua index 8f0570e..44fd8a4 100644 --- a/after/plugin/gitsigns.lua +++ b/after/plugin/gitsigns.lua @@ -8,8 +8,6 @@ gitsigns.setup { numhl = true, } -local bufnr = vim.api.nvim_get_current_buf() - local map = require("opdavies.keymap").map local nmap = require("opdavies.keymap").nmap local vmap = require("opdavies.keymap").vmap @@ -17,20 +15,22 @@ local vmap = require("opdavies.keymap").vmap nmap { "[h", "Gitsigns prev_hunk" } nmap { "]h", "Gitsigns next_hunk" } -nmap { "hR", gitsigns.reset_buffer } -nmap { "hS", gitsigns.stage_buffer } -nmap { "hp", gitsigns.preview_hunk } -nmap { "hr", gitsigns.reset_hunk } -nmap { "hs", gitsigns.stage_hunk } -nmap { "hu", gitsigns.undo_stage_hunk } +nmap { "gR", gitsigns.reset_buffer } +nmap { "gS", gitsigns.stage_buffer } +nmap { "gb", gitsigns.blame_line } +nmap { "gp", gitsigns.preview_hunk } +nmap { "gr", gitsigns.reset_hunk } +nmap { "gs", gitsigns.stage_hunk } +nmap { "gu", gitsigns.undo_stage_hunk } + vmap { - "hr", + "gr", function() gitsigns.reset_hunk { vim.fn.line ".", vim.fn.line "v" } end, } vmap { - "hs", + "gs", function() gitsigns.stage_hunk { vim.fn.line ".", vim.fn.line "v" } end,