Update gitsigns keymaps

This commit is contained in:
Oliver Davies 2024-03-14 01:41:40 +00:00
parent c1d2b1d7af
commit b4ca3831b0
2 changed files with 14 additions and 10 deletions

View file

@ -6,6 +6,10 @@
* Add `committia.vim` to improve the commit buffer when running `git commit`. * 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 ## 12th March 2024
### Added ### Added

View file

@ -8,8 +8,6 @@ gitsigns.setup {
numhl = true, numhl = true,
} }
local bufnr = vim.api.nvim_get_current_buf()
local map = require("opdavies.keymap").map local map = require("opdavies.keymap").map
local nmap = require("opdavies.keymap").nmap local nmap = require("opdavies.keymap").nmap
local vmap = require("opdavies.keymap").vmap local vmap = require("opdavies.keymap").vmap
@ -17,20 +15,22 @@ local vmap = require("opdavies.keymap").vmap
nmap { "[h", "<cmd>Gitsigns prev_hunk<CR>" } nmap { "[h", "<cmd>Gitsigns prev_hunk<CR>" }
nmap { "]h", "<cmd>Gitsigns next_hunk<CR>" } nmap { "]h", "<cmd>Gitsigns next_hunk<CR>" }
nmap { "<leader>hR", gitsigns.reset_buffer } nmap { "<leader>gR", gitsigns.reset_buffer }
nmap { "<leader>hS", gitsigns.stage_buffer } nmap { "<leader>gS", gitsigns.stage_buffer }
nmap { "<leader>hp", gitsigns.preview_hunk } nmap { "<leader>gb", gitsigns.blame_line }
nmap { "<leader>hr", gitsigns.reset_hunk } nmap { "<leader>gp", gitsigns.preview_hunk }
nmap { "<leader>hs", gitsigns.stage_hunk } nmap { "<leader>gr", gitsigns.reset_hunk }
nmap { "<leader>hu", gitsigns.undo_stage_hunk } nmap { "<leader>gs", gitsigns.stage_hunk }
nmap { "<leader>gu", gitsigns.undo_stage_hunk }
vmap { vmap {
"<leader>hr", "<leader>gr",
function() function()
gitsigns.reset_hunk { vim.fn.line ".", vim.fn.line "v" } gitsigns.reset_hunk { vim.fn.line ".", vim.fn.line "v" }
end, end,
} }
vmap { vmap {
"<leader>hs", "<leader>gs",
function() function()
gitsigns.stage_hunk { vim.fn.line ".", vim.fn.line "v" } gitsigns.stage_hunk { vim.fn.line ".", vim.fn.line "v" }
end, end,