Re: [PATCH] contrib/git-jump: cat output when not a terminal
- From
- George Brown <321.george@gmail.com>
- Date
- May 10, 2020, 20:20 UTC
- Message-ID
- <CAFKec1VGMwn3_4AEuY8Vrs60UQbX-fvqCkzKd8VARAUScbA=rA@mail.gmail.com>
- In-Reply-To
- <xmqqftc7twaa.fsf@gitster.c.googlers.com>
> I somehow doubt that users of vim types "!git jump diff" (or > whichever submode they want) from within vim's command prompt; > wouldn't they typically wrap the invocation in a vim macro?
Correct, in Vim parlance we'd create a command for this.
Show 13 quoted lines
> If my suspicion is correct, with an opt-in feature like the above > (which is designed not to hurt existing users), the vim users can > change their macro definition to not just invoke "git jump > <whatever>", but invoke "GIT_JUMP_AUTO_CAT=yes git jump <whatever>", > i.e. tell "git jump" that you are opting into the "cat the file, > instead of launching GIT_EDITOR". So with just a one-time setting, > vim (and other similar editor) users would benefit without hurting > others. > > For that matter, instead of introducing GIT_JUMP_AUTO_CAT, the same > mechanism can be used to run "GIT_EDITOR=cat git jump <whatever>", > i.e. tell "git jump" that it is expected to run "cat" as its > editor, from such a vim macro ;-)
Yes. Another version that someone else implemented used similar method by unsetting "$GIT_EDITOR" when invoked from Vim and modified "git jump" to use cat when "$GIT_EDITOR" was empty.
https://gist.github.com/romainl/a3ddb1d08764b93183260f8cdf0f524f/e1f548f6d96cd6ee97c3daadb4a1546fab7814ad
I can request the author submit that as a patch if it is of interest.