Re: [PATCH] add -p: introduce 'w' command to view hunk with --word-diff
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- May 11, 2026, 19:16 UTC
- Message-ID
- <CALnO6CCR9bQ71LR_buEAzX4UcR4sERnaVLc6_19sJUfXyi-HPA@mail.gmail.com>
- In-Reply-To
- <xmqqqznix0ko.fsf@gitster.g>
On Sun, May 10, 2026 at 8:16 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 21 quoted lines
> > "D. Ben Knoble" <ben.knoble@gmail.com> writes: > > > I concur, though I wonder what other diff options would be useful. I > > can imagine a world where "add --patch" allows to reshow the patch > > with any set of custom options. Spitballing… > > > > :show <opts> > > > > …could work, since we have room to allow long-form commands still. > > This could be extended to arbitrary git-* commands, and ":!cmd" could > > be used for shelling out. > > (Can you tell I use Vim?) > > > > Anyway, what I like about this is we don't have to worry about running > > out of (or thinking up new mnemonics for) single letters for different > > combinations of diff options, so it's a bit more extensible. > > > If you mean "don't waste a new letter, like 'w', every time you come > up with a use case to show the patch hunk differently",
Precisely
Show 6 quoted lines
> I had the > same reaction to suggest reusing 'p' but allow options after it, > just like the output from "git diff" can be modified by giving it an > option "--word-diff". But how would it work for single-key folks (I > am not one of them so I have less sympathy than I should in this > case, but still...).
Ah, I hadn't remembered we already had p/P. Perhaps - in non-single-key mode, p/P can take options. and/or - ":" is an exception to single-key mode and always allows more text to compose a longer-form "command". The first command could be "print" which takes options of this kind.
Since ":" would be new, exempting it from single-key mode shouldn't be too jarring I guess.
-- D. Ben Knoble