[PR #5903] feat(tui): Allow keybinding of custom slash commands (resolves #5904) #11637

Open
opened 2026-02-16 18:16:32 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5903

State: open
Merged: No


feat: add keybind support for custom slash commands Allow users to bind custom slash commands to keystrokes by adding
entries to the keybinds config with keys starting with '/'. When one of these keys is struck, command is inserted before the text in the main prompt text input box and then that input is submitted, allowing arguments to be passed to custom slash commands as normal (e.e., if the text input box contains foo "bar" and a key is struck to trigger /my-command, then /my-command foo "bar" is submitted`).

If the slash command referenced by a keybinding does not exist when they key is struck (e.g., if the command's .md file was deleted while opencode was running) this is handled safely, and a toast is displayed indicating that no such command existsts.

I've been using this feature all week in my personal fork and it has made a truly tremendous difference in my workflow, i really think that this one is a killer feature.

Changes:

  • Update Config.Keybinds schema to accept arbitrary keys using catchall
  • Add keyboard handler in TUI to match and execute command keybinds
  • Regenerate TypeScript SDK to reflect updated KeybindsConfig type

When a command keybind is pressed, the prompt is set to the command
text and immediately submitted, executing the custom command.

Example usage in config.json:

{
  "$schema": "https://opencode.ai/config.json",
  "keybinds": {
    "/commit-and-push--using-big-pickle": "ctrl+alt+c",
    "/fetch-and-pull-all-branches--using-glm-4.6": "ctrl+alt+f",
    "/merge-dev-into-branch-resolve-conflicts-and-push--using-copilot-sonnet": "ctrl+alt+m",
    "/integrate-the-branches-listed-in-yoinklistmd--using-antigravity-opus": "ctrl+alt+i",
    "/integrate-the-branches-listed-in-yoinklistmd--using-copilot-opus": "ctrl+alt+shift+i",
  }
}

Resolves #5904.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5903 **State:** open **Merged:** No --- feat: add keybind support for custom slash commands Allow users to bind custom slash commands to keystrokes by adding entries to the keybinds config with keys starting with '/'. When one of these keys is struck, command is inserted before the text in the main prompt text input box and then that input is submitted, allowing arguments to be passed to custom slash commands as normal (e.e., if the text input box contains `foo "bar"` and a key is struck to trigger `/my-command`, then `/my-command foo "bar"` is submitted`). If the slash command referenced by a keybinding does not exist when they key is struck (e.g., if the command's `.md` file was deleted while opencode was running) this is handled safely, and a toast is displayed indicating that no such command existsts. I've been using this feature all week in my personal fork and it has made a truly _tremendous_ difference in my workflow, i really think that this one is a killer feature. ### Changes: - Update Config.Keybinds schema to accept arbitrary keys using catchall - Add keyboard handler in TUI to match and execute command keybinds - Regenerate TypeScript SDK to reflect updated KeybindsConfig type When a command keybind is pressed, the prompt is set to the command text and immediately submitted, executing the custom command. ### Example usage in config.json: ```json { "$schema": "https://opencode.ai/config.json", "keybinds": { "/commit-and-push--using-big-pickle": "ctrl+alt+c", "/fetch-and-pull-all-branches--using-glm-4.6": "ctrl+alt+f", "/merge-dev-into-branch-resolve-conflicts-and-push--using-copilot-sonnet": "ctrl+alt+m", "/integrate-the-branches-listed-in-yoinklistmd--using-antigravity-opus": "ctrl+alt+i", "/integrate-the-branches-listed-in-yoinklistmd--using-copilot-opus": "ctrl+alt+shift+i", } } ``` Resolves #5904.
yindo added the pull-request label 2026-02-16 18:16:32 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11637