Skip to content

Commit

Permalink
Update .config/nvim/lua/plugins/gitsigns.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyuga-Tsukui committed Oct 30, 2024
1 parent 8cb21ae commit c2ae053
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion dot_config/nvim/lua/plugins/gitsigns.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
return {
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup()
require("gitsigns").setup({
on_attach = function(bufnr)
local gitsigns = require("gitsigns")

local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end

-- Actions
map("n", "<leader>hs", gitsigns.stage_hunk)
map("n", "<leader>hu", gitsigns.undo_stage_hunk)
map("v", "<leader>hs", function()
gitsigns.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
end)
map("v", "<leader>hu", function()
gitsigns.undo_stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
end)
map("v", "<leader>hr", function()
gitsigns.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
end)
end,
})
end,
}

0 comments on commit c2ae053

Please sign in to comment.