Re: [PATCH 5/5] add-patch: render hunks through the pager
- From
Jeff King <peff@peff.net>
- Date
- May 25, 2024, 04:54 UTC
- Message-ID
- <20240525045434.GC1895047@coredump.intra.peff.net>
- In-Reply-To
- <xmqqjzjky6eo.fsf@gitster.g>
On Thu, May 23, 2024 at 07:00:47AM -0700, Junio C Hamano wrote:
Show 31 quoted lines
> 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'.
Ooh, I like all of that (including "|", which is what triggers the similar feature in mutt). If interactive.pipeCommand defaults to the usual pager, then a bare "|" would do what most people want.
-Peff