Is there any submap feature in lazygit? #5052
-
|
Hello, I've started using lazygit for 2 months. I don't know, but I wanted to ask, is there any submap feature in lazygit? I want to add my custom git aliases as a submap. If not, I would love to have this feature in lazygit. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
|
What is a submap? Can you explain in more detail what you want to do? |
Beta Was this translation helpful? Give feedback.
-
|
@stefanhaller A submap basically like a menu option which contains set of specific assigned keys which allows us to use a single key combination to perform multiple set of option. Here is a short example from hyprland: Here we press This allows me to add more keymaps in a single key combination menu. |
Beta Was this translation helpful? Give feedback.
-
|
I'm keeping this sample code for future visitors for answer keybinding:
universal:
pushFiles: <disabled>
pullFiles: <disabled>
customCommands:
- key: "C"
command: "git cz"
description: "commit with commitizen"
context: "files"
loadingText: "opening commitizen commit tool"
output: terminal
- key: "P"
description: "Push"
commandMenu:
- key: p
command: "git push --force-with-lease"
description: "Push"
loadingText: "Pushing"
- key: a
command: "git remote | xargs -L1 git push --all"
description: "Push (Remotes)"
loadingText: "Pushing to all remotes"
- key: A
command: "git remote | xargs -L1 git push --all --force"
description: "Push (Remotes + Force)"
loadingText: "Pushing to all remotes by force"
- key: "p"
description: "Pull"
commandMenu:
- key: p
command: "git pull --no-edit"
description: "Pull"
loadingText: "Pulling"
- key: r
command: "git pull --rebase"
description: "Pull (Rebase)"
loadingText: "Pulling with rebase"
|
Beta Was this translation helpful? Give feedback.

We have many examples of this in lazygit, e.g. the rebase menu in the branches panel, the bisect menu in the Commits panel, and many others. We do these case-by-case if we find that a particular command benefits from more finegrained options. Sometimes we add these later on for commands that originally didn't have them; one example is the
dcommand in the branches panel, which initially only showed a confirmation ("Are you sure you want to delete this branch?"), and later we turned it into a menu with more options.For your custom git aliases, it sounds like you want to use custom commands, which also have this feature. See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_…