Skip to content

Keybindings for Custom Command's Prompt menus #3626

@rtalexk

Description

@rtalexk

I'm creating a custom command with a menu prompt, similar to the "Reset to [commit hash]" menu.

image

Mine looks like this:

image
Configuration

In summary, what this does is allowing me to edit a file by reusing an existing $EDITOR instance in a Tmux window. Or, I can also choose to edit the file in the current window, or in a new $EDITOR instance (that's handled by the lazygit_edit_cmd script).

customCommands:
  - name: "edit"
    context: "files"
    key: "e"
    prompts:
      - type: "menu"
        title: "Editor instance"
        key: "WinChoise"
        options:
          - value: "reuse"
            description: "Search for a Window with an EDITOR instance"
            key: "r" # <-- This is what I want
          - value: "current"
            description: "Edit the file in the current window"
            key: "c" # <-- This is what I want
          - value: "new"
            description: "Edit the file in a new window"
            key: "n" # <-- This is what I want
    command: "lazygit_edit_cmd -w {{.Form.WinChoise}} {{.SelectedFile.Name}}"
    subprocess: true

Describe the solution you'd like
What I would like to have is mapping some keybinding to options in the prompt menu, just as in the Reset menu with m for Mixed, s for Soft and h for Hard reset.

Right now I mostly use the "Reuse" option (that's why it is the first one), and that's my workaround, but it would be cool if that's something that can be configured.

I read the Custom Commands docs and I didn't see any way to set bindings, if I missed that part please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions