tanvirtin / vgit.nvim

Visual git plugin for Neovim
MIT License
591 stars 11 forks source link

Ability to make 'hunk_up', 'hunk_down' jump to next hunk on multi-line hunks #225

Closed ibhagwan closed 2 years ago

ibhagwan commented 2 years ago

Currently, on hunks that span multiple line, hunk_up|down sends you to the next edge of the hunk, would be nice to have the ability to jump to the next hunk directly.

The behavior is pretty consistent and the logic works the same for hunk_up so I'm assuming it's a feature and not a bug.

Given the file below, the first hunk_down sends you to line 2 and then the next hunk_down sends you to line 3, to get to the 2nd change (line 5) I have to press my hunk_down keybind 3 times:

 1
|2  changed line    <== after first hunk_down
|3  changed line    <== after second hunk_down
 4
|5  changed line    <== after third hunk_down
 6
tanvirtin commented 2 years ago

Yeah this was an intentional design decision. The reason behind it was to make navigations easier when you had really large hunks.

If more plugin users dislike it, I am open to changing it.

ibhagwan commented 2 years ago

more plugin users dislike it, I am open to changing it.

Not sure how I feel about it yet, in some ways it’s beneficial when you have really large hunks but it doesn’t make much sense when you have small 2-3 line hunks, perhaps it’s best to have a setting or the ability to send hunk_down a call option to determine behavior, either blanket jump to next hunk or perhaps minimum number of lines in a hunk to trigger end of hunk navigation?

ibhagwan commented 2 years ago

Ty @tanvirtin!