-
Notifications
You must be signed in to change notification settings - Fork 5.1k
feat(tui): Allow keybinding of custom slash commands (resolves #5904) #5903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ariane-emory
wants to merge
50
commits into
anomalyco:dev
Choose a base branch
from
ariane-emory:feat/keybindable-commands
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(tui): Allow keybinding of custom slash commands (resolves #5904) #5903
ariane-emory
wants to merge
50
commits into
anomalyco:dev
from
ariane-emory:feat/keybindable-commands
+199
−9
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3cb88f0 to
1879881
Compare
1879881 to
6945498
Compare
- DialogSelect: Add prefix-first alphabetical sorting to filtered results - Remove commented-out sort in grouped memo since sorting is now done in filtered() - DialogModel: Add sortWithPrefixFirst helper for custom filtering logic - Preserve 'Free first' ordering within filtered groups - Ensures consistent alphabetical ordering in /theme and /models menus
Resolved merge conflict in dialog-model.tsx by combining: - Advanced prefix-first sorting with 'Free first' ordering from fix branch - Recents limit to 5 items from dev branch Both filtering and sorting improvements are now preserved.
…ory/opencode into fix/modal-menus-filtered-order
…ory/opencode into fix/modal-menus-filtered-order
04ba91e to
239fed6
Compare
Replace Keybinds schema .strict() with .catchall() + .superRefine() to: - Allow custom keybind keys that start with '/' (slash command names) - Reject unknown keys that don't start with '/' with a clear error message - Preserve validation for all predefined keybind names Add tests for slash command keybind acceptance and rejection of invalid keys. Regenerate SDK types to include index signature for custom keybinds.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
.mdfile 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:
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.