Re: [PATCH 5/5] add-patch: render hunks through the pager
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 23, 2024, 14:00 UTC
- Message-ID
- <xmqqjzjky6eo.fsf@gitster.g>
- In-Reply-To
- <20240523090601.GC1306938@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> I do still think it > would be useful to be able to configure its pager separately (in my > case, I'd use "less -FX" rather than my default setup, which doesn't use > either of those options).
Even better. Allow to optionally have the command after the option, e.g.,
(1/1) Use this hunk [y,n,q,j,k,e,p,P] P<RET>
(1/1) Use this hunk [y,n,q,j,k,e,p,P] Pless -FX<RET>
(1/1) Use this hunk [y,n,q,j,k,e,p,P] Pcat<RET>The first one feeds the default program with the hunk via pipe, the second one instead invokes command you specifed, "less -FX", and feeds the hunk to it via a pipe. The last one emulates a plain 'p' behaviour.
And for usability, perhaps giving a specific command would change the default program a bare 'P' invokes for the rest of the session until another specific command overrides. Another usability hack may be "[interactive] pipecommand = less -FX" configuration variable gives the initial default for each session.
At that point, we can explain it as
p - print the current hunk P[<program>] - pipe the current hunk to a program
or even use '|' instead of 'P'.