Skip to content

Commit

Permalink
fix(keymap.ui): update gitsign keymaps (#1411)
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesChiuGit authored Feb 3, 2025
1 parent ef639cb commit 090c9c9
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lua/keymap/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ bind.nvim_load_mapping(mappings.plugins)
local M = {}

function M.gitsigns(bufnr)
local actions = require("gitsigns.actions")
local gitsigns = require("gitsigns")
local map = {
["n|]g"] = map_callback(function()
if vim.wo.diff then
return "]g"
end
vim.schedule(function()
actions.next_hunk()
gitsigns.nav_hunk("next")
end)
return "<Ignore>"
end)
Expand All @@ -108,7 +108,7 @@ function M.gitsigns(bufnr)
return "[g"
end
vim.schedule(function()
actions.prev_hunk()
gitsigns.nav_hunk("prev")
end)
return "<Ignore>"
end)
Expand All @@ -117,50 +117,50 @@ function M.gitsigns(bufnr)
:with_expr()
:with_desc("git: Goto prev hunk"),
["n|<leader>gs"] = map_callback(function()
actions.stage_hunk()
gitsigns.stage_hunk()
end)
:with_buffer(bufnr)
:with_noremap()
:with_desc("git: Toggle staging/unstaging of hunk"),
["v|<leader>gs"] = map_callback(function()
actions.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
gitsigns.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
end)
:with_buffer(bufnr)
:with_noremap()
:with_desc("git: Toggle staging/unstaging of selected hunk"),
["n|<leader>gr"] = map_callback(function()
actions.reset_hunk()
gitsigns.reset_hunk()
end)
:with_buffer(bufnr)
:with_noremap()
:with_desc("git: Reset hunk"),
["v|<leader>gr"] = map_callback(function()
actions.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
gitsigns.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
end)
:with_buffer(bufnr)
:with_noremap()
:with_desc("git: Reset hunk"),
["n|<leader>gR"] = map_callback(function()
actions.reset_buffer()
gitsigns.reset_buffer()
end)
:with_buffer(bufnr)
:with_noremap()
:with_desc("git: Reset buffer"),
["n|<leader>gp"] = map_callback(function()
actions.preview_hunk()
gitsigns.preview_hunk()
end)
:with_buffer(bufnr)
:with_noremap()
:with_desc("git: Preview hunk"),
["n|<leader>gb"] = map_callback(function()
actions.blame_line({ full = true })
gitsigns.blame_line({ full = true })
end)
:with_buffer(bufnr)
:with_noremap()
:with_desc("git: Blame line"),
-- Text objects
["ox|ih"] = map_callback(function()
actions.select_hunk()
gitsigns.select_hunk()
end)
:with_buffer(bufnr)
:with_noremap(),
Expand Down

0 comments on commit 090c9c9

Please sign in to comment.