Skip to content

Conversation

gangelop
Copy link
Contributor

@gangelop gangelop commented Aug 22, 2023

Originally, the keymaps for jumping to next and previous git hunks were ]c and [c. This was changed in #323 (83b65a1) because they overwrote the built-in vimdiff keymaps.

However, the more traditional solution is to have ]c and [c extend the built-in keymap. This is what fugitive and gitgutter have been doing for years.

Gitsigns doesn't do this by itself, but it has a recommended keymap configuration on which the present patch is based:

https://github.com/lewis6991/gitsigns.nvim#keymaps

The only thing I've added is to have the keymaps work in visual mode as well, which is the same behavior as the built in vimdiff keymaps.

Originally, the keymaps for jumping to next and previous git hunks were
]c and [c. This was changed in nvim-lua#323 (83b65a1) because they overwrote the
built-in vimdiff keymaps.

However, the more traditional solution is to have ]c and [c *extend* the
built-in keymap. This is what fugitive and gitgutter have been doing for
years.

Gitsigns doesn't do this by itself, but it has a recommended keymap
configuration on which the present patch is based:

	https://github.com/lewis6991/gitsigns.nvim#keymaps

The only thing I've added is to have the keymaps work in visual mode as
well, which is the same behavior as the built in vimdiff keymaps.
@feoh
Copy link
Collaborator

feoh commented Aug 29, 2023

I haven't really delved into gitsign enough so I can't comment on this.

@antoineco seems like you approve this change? Have you tested it?

Will I get a raft of "AAH YOU MOVED MY CHEESE!" angry comments if I merge this? :)

@feoh
Copy link
Collaborator

feoh commented Sep 5, 2023

Can I ask you to do some homework so we can move this PR along if in fact it makes sense to merge?

Please go back and find the PRs from the folks who made the change you disagree with. Please at least try @-ing them to see if you can come to consensus on a solution.

If you can, it's an easy merge from my end. If you can't, then we'll keep working on this. I really do appreciate the contribution!

@gangelop
Copy link
Contributor Author

gangelop commented Sep 5, 2023

Hi @luizcalliari 👋

In #323 (83b65a1) you changed the ]c and [c mappings for gitsigns because they conflicted with vimdiff.
I'm trying to bring them back in a way that doesn't conflict with vimdiff.
The expected result is that ]c and [c should take you to next and previous hunk when there are git differences but when you open the file in a vimdiff, the same keys should take you to the next and previous difference in the diff.

Would you mind testing the patch in the current PR to confirm that it still accomplishes what you intended with your earlier change?

@antoineco
Copy link

@feoh sorry I completely missed your mention. Yes I do think that the change is sensible, and it works as expected for me 👍

@feoh
Copy link
Collaborator

feoh commented Sep 6, 2023

The more I look at this, the more I think it's a good idea. @luizcalliari -f you respond fairly soonish with any objections we can discuss it, otherwise I think I'm gonna merge this.

Nothing is set in stone, this is Git after all :)

@luizcalliari
Copy link
Contributor

Hello guys!! I've no objection!! Good job @gangelop!!!

@feoh feoh merged commit c010cc7 into nvim-lua:master Sep 6, 2023
@feoh
Copy link
Collaborator

feoh commented Sep 6, 2023

Thank you everyone! Merged.

qiuye2015 pushed a commit to qiuye2015/fjp.nvim that referenced this pull request Dec 10, 2023
Revert gitsigns keymaps but fix vimdiff and fugitive conflict
s-frick pushed a commit to s-frick/kickstart.nvim that referenced this pull request Jul 29, 2024
Revert gitsigns keymaps but fix vimdiff and fugitive conflict
melobern added a commit to melobern/kickstart.nvim that referenced this pull request Oct 30, 2024
Revert gitsigns keymaps but fix vimdiff and fugitive conflict
felixhummel added a commit to felixhummel/nvim that referenced this pull request Dec 19, 2024
Revert gitsigns keymaps but fix vimdiff and fugitive conflict
restray added a commit to restray/kickstart.nvim that referenced this pull request Mar 16, 2025
Revert gitsigns keymaps but fix vimdiff and fugitive conflict
tedleahy pushed a commit to tedleahy/kickstart.nvim that referenced this pull request May 16, 2025
Revert gitsigns keymaps but fix vimdiff and fugitive conflict
invalidoperation pushed a commit to invalidoperation/kickstart.nvim that referenced this pull request Jun 14, 2025
Revert gitsigns keymaps but fix vimdiff and fugitive conflict
apriljarosz pushed a commit to apriljarosz/kickstart.nvim that referenced this pull request Jun 19, 2025
Revert gitsigns keymaps but fix vimdiff and fugitive conflict
eduardofuncao pushed a commit to eduardofuncao/config.nvim that referenced this pull request Aug 5, 2025
Revert gitsigns keymaps but fix vimdiff and fugitive conflict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants