lazygit
lazygit copied to clipboard
Showing actual git command for key bindings in menu
Is your feature request related to a problem? Please describe.
The menu (i.e. pressing x) is really helpful, but it doesn't show the actual git command for a given key binding and what is going to happen when executing. For instance, it is not clear what the d (delete commit) actually does and led to a related #2426 issue. I know that the command Log does show the commands but only after executing the command and not before.
Describe the solution you'd like
Showing the actual git command when selecting an entry in the menu. I.e. after pressing x and going down to d delete commit in the commit window, it should show somewhere what is going to happen. On top of the git log ideally even an intuitive explanation, typical application or even a link.
Describe alternatives you've considered An alternative would we to have a text/help file with mapping - command association. I couldn't find that in the code base either however.
An alternative would we to have a text/help file with mapping - command association. I couldn't find that in the code base either however.
We do have that, it's called a "tooltip" and it appears under menus (screenshot)

Helpful tooltips for all kinds of commands are always welcome, be it in the form of an issue, discussion, or PR!
Thanks, I wasn't aware of tooltips, that looks like something in the right direction. However I can't seem to be able to find them? How are they shown/activated? Thanks a lot!
My version is:
lazygit -v
commit=324e76eff33202098f950d00eee4cbef64c9c0f2, build date=2023-02-02T08:34:57Z, build source=unknown, version=324e76ef, os=linux, arch=amd64, git version=2.39.2

They're activated automatically for those items that do have a tooltip:

But those that were at the time of writing considered self explanatory are missing a tooltip.
Ah, I see now, z indeed has a tooltip, but many other commands do not, so it's a matter of slowly populating them, now I also get your statement:
Helpful tooltips for all kinds of commands are always welcome, be it in the form of an issue, discussion, or PR!
This is definitely what I would have in mind in principle, however it would be good to also show the actual command, maybe along with the tooltip, is there any way to find out the command?
is there any way to find out the command?
Only by digging through the source, I'm afraid.
But to be honest, what the command is actually doing seems to me like an implementation detail, not something we need to burden the user with.
As an example, the stash staged changes command sounds simple at first, but in the background it's:
- creating a stash while keeping the index
- stashing everything
- applying the
stash@{1} - applying the top of the stash list in reverse
- dropping
stash@{1} - cleaning up untracked files that were stashed
What I'm getting at, it's not just one command that we can display to the user, so while it does make sense to write tooltips for some commands, for others it's better to stay hidden behind a somewhat high-level description.
Good point, looking from this angle, you are right. However for simple commands it can be useful especially for usecases as in #2426 . At least I sometimes don't know what a command might have as a consequence, but at least showing the command usually helps (especially for user that know the git commands; for the ones who don't know, it could be used as education). So even without tooltip, it would be good to have a straighforward way to find out the command quickly, maybe as addition to a md file which is listing all the bindings?
All in all I agree with the sentiment, the tooltips are useful.
On the other hand, I can't help to think that describing that e.g. "dropping a commit is actually an interactive rebase and may not work over merge commits" is something that is just the way lazygit does it and may not prove useful to the user.
a md file which is listing all the bindings?
I guess? If you mean automating storing the default keymappings, their descriptions and tooltips into a Instructions.md, that could prove useful, but I'd only consider it if it's automated, nobody wants to do this things by hand.
I'm in favour of showing the command we're gonna run when it's going to be a single command: it gives confidence to users who aren't sure what lazygit is gonna do under the hood (similar to the confidence that the log panel gives).
However it would be hard to implement this. The actual command we run may change depending on context, and so we'd need to obtain that context ahead of time if we're showing the command in a tooltip. If we just hard code the command in the tooltip, then we'll need to keep it in-sync with what we're actually doing.
Even if we have a catch-all approach for when multiple commands are run (e.g. just say 'runs multiple git commands'), it's still going to be hard to implement this for single commands. So I'm in favour, but it would be a big change.