jreybert / vimagit

Ease your git workflow within Vim
1.31k stars 49 forks source link

Split hunks #158

Closed SevereOverfl0w closed 6 years ago

SevereOverfl0w commented 6 years ago

It would be convenient to have a command for splitting hunks into smaller hunks. Much like the interactive patch command does with s.

I've had a few cases where lines changed close to each other, but were fully independent.

jreybert commented 6 years ago

Hi,

not sure to understand. It seems you are asking for one of the main vimagit feature.

You can stage part of hunk, either:

See https://github.com/jreybert/vimagit#visual-selection

You can even edit a line before staging, allowing you stage part of line, see https://github.com/jreybert/vimagit#inline-modifications

SevereOverfl0w commented 6 years ago

I possibly just ran into an edge case. I solved my problem by using a visual selection at the time though.

The feature I was really asking for was the ability for vimagit to break down the hunk for me, because there's reassurance in seeing the hunk first I think, I'm also quite lazy.

On February 1, 2018 1:17:41 PM GMT+00:00, "Jérôme Reybert" notifications@github.com wrote:

Hi,

not sure to understand. It seems you are asking for one of the main vimagit feature.

You can stage part of hunk, either:

  • by visually selecting lines with v, then staging selection with S
  • by marking lines with M, then staging selection with S
  • by staging line by line, with L

See https://github.com/jreybert/vimagit#visual-selection

You can even edit a line before staging, allowing you stage part of line, see https://github.com/jreybert/vimagit#inline-modifications

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/jreybert/vimagit/issues/158#issuecomment-362262951

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

jreybert commented 6 years ago

You can also force git to shrink/enlarge the diff context, using the keys + and -. Then, you will get smaller/larger hunks.

But you can't say to vimagit (which means saying to git in the end): split the display of this hunk at this point.

jreybert commented 6 years ago

OK, I now understand what you meant (I did not know the s command in git add patch interactive mode.

Well, maybe the shrink/enlarge mapping could update only the current hunk.

Is this feature a real need for you?

SevereOverfl0w commented 6 years ago

The +/- was something I tried, but didn't have the desired effect. Admittedly, it didn't seem to do anything, so I might have been doing something wrong.

Strong need? I'm not sure. I've only applied vimagit a handful of times, but it's come up on about 40% of my attempts at using it.