Closed hsayed21 closed 2 months ago
This is already possible with stage_hunk
which toggles the stage status.
I tried it nothing changed in two modes normal or visual
_map("n", "<leader>gs", gs.stage_hunk, "Stage hunk")
_map("v", "<leader>gs", function() gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) end, "Stage hunk")
You need to pull in the latest changes to include https://github.com/lewis6991/gitsigns.nvim/commit/b8cf5e8efaa0036d493a2e2dfed768c3a03fac73
Sorry, but I don't understand what I should do. Do you mean I need to update the plugin?
Yes. Make sure to always have the latest version installed before raising issues on a tracker.
Sorry for not paying attention. I did the update and it worked, but there's a problem in visual mode where 'unstage' doesn't work
Yeah unstage does not work in visual mode
map("v", "<leader>sh", function()
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
end)
Look at the code, if range is specified the staged hunk does not really caculated, it simply using current line https://github.com/lewis6991/gitsigns.nvim/blob/39b5b6f48bde0595ce68007ffce408c5d7ac1f79/lua/gitsigns/actions.lua#L242 @lewis6991 this should be reopen?
@lewis6991 this should be reopen?
That won't fix it. A PR might.
Description
Description
I would like to request a feature that allows users to unstage changes on the current line where the cursor is focused. This functionality would complement the existing
stage_hunk
,reset_hunk
, andundo_stage_hunk
functions by providing more granular control over staging and unstaging changes.Proposed Solution
A new function,
unstage_hunk
, could be introduced with the following behavior:Thank you for considering this feature request. I believe it would be a valuable addition to the
gitsigns.nvim
plugin, enhancing its utility and user experience.Neovim version
_
Operating system and version
_
Expected behavior
_
Actual behavior
_
Minimal config
Steps to reproduce
_
Gitsigns debug messages
_