Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

select_hunk not working as expected on visual modes #1133

Open
gabs712 opened this issue Oct 10, 2024 · 0 comments
Open

select_hunk not working as expected on visual modes #1133

gabs712 opened this issue Oct 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@gabs712
Copy link

gabs712 commented Oct 10, 2024

Description

Buggy behavior when using gitsigns.select_hunk or <cmd>Gitsigns select_hunk<CR>.
If used in visual or visual block mode, instead of selecting the whole hunk, it only selects
until the end of it. For visual line, the cursor will jump to the end of hunk without selecting
anything.

I've also noticed that :Gitsigns select_hunk<CR> works fine, but i tend to avoid using keymaps
starting with :, as it can cause little annoyances on my particular config. It's just not as consistent.

Neovim version

v0.11.0

Operating system and version

Ubuntu 24.04.1

Expected behavior

For all visual modes:
Screenshot_20241009_210839

Actual behavior

Visual and visual block:
Screenshot_20241009_211220

Visual line:
Screenshot_20241009_211250

Minimal config

local gitsigns = require('gitsigns')

vim.keymap.set({ 'o', 'x' }, 'ih', gitsigns.select_hunk, { desc = 'Select hunk' })

Steps to reproduce

  1. mkdir gitsigns_issue
  2. cd gitsigns_issue
  3. git init
  4. touch file
  5. git add file
  6. git commit -m 'initial commit'
  7. nvim file
  8. Add some new lines
  9. Go to any new line on the hunk after the first one
  10. Type vih, Vih or <C-v>ih

Gitsigns debug messages

No response

Gitsigns cache

No response

@gabs712 gabs712 added the bug Something isn't working label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant