Re: [PATCH/TOY] Shortcuts to quickly refer to a commit name with keyboard
- From
Jeff King <peff@peff.net>
- Date
- Jan 20, 2017, 16:09 UTC
- Message-ID
- <20170120160942.srqf4y5w5r6feidw@sigill.intra.peff.net>
- In-Reply-To
- <20170120102249.15572-1-pclouds@gmail.com>
On Fri, Jan 20, 2017 at 05:22:49PM +0700, Nguyễn Thái Ngọc Duy wrote:
Show 10 quoted lines
> OK This patch is horrible. Though the idea is cool and I've found it > very useful. So here it is. Perhaps the idea may be revised a bit > that's more suitable for more than one user. > > The problem is old, SHA-1 name is not keyboard-friendly, even in > abbreviated form. And recent change has made abbrev form longer, > harder to type. Most of the time I just go with copy/paste with the > mouse, which I don't like. name-rev helps a bit, but it's still long > to type (especially with all the ^ and ~ that requires holding shift > down).
Not really a comment on your patch itself, but I think a lot of people solve this at a higher level, either in their terminal or via a tool like tmux.
I recently taught urxvt to recognize sha1s and grab them via keyboard hints, and I'm finding it quite useful. Here's what it looks like if you're interested:
http://peff.net/git-hints.gif
The hints technique is taken from pentadactyl (which I also use), but the urxvt port is mine. I'm happy to share the code.
Which isn't to say solving it inside Git is wrong, but I've found it really convenient for two reasons:
1. It works whenever you see a sha1, not just in git commands (so
emails, inside commit messages, etc).2. It doesn't take any screen space until you're ready to select.
The big downside is that it's scraping the screen, so you're guessing at what is a sha1. False positives are a little annoying, but usually not that big a deal because you're already looking at what you want to select, and the hint pops up right there.
-Peff