[FEATURE] Generic bindable action to send literal text / run a command from a keypress
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
keybindings.json can only map a key to a fixed enum of built-in actions. There is no way to bind a key to arbitrary text, or to a slash command. As a result, text I type constantly — "Continue", "yes", /clear — can't be put on a single key.
Because the action set is closed, every new capability has to be shipped as its own named action, which has produced a stream of narrow one-off requests (#57600 bindable /clear, #60865 word-delete actions, #64855 bash-mode submit variants, #62621 transcript prompt-jump). A single generic "send text" action would subsume this entire class.
Proposed Solution
Allow a binding's action value to be an object, not just a string:
{
"context": "Chat",
"bindings": {
"ctrl+g": { "type": "sendText", "text": "Continue", "submit": true },
"ctrl+shift+k": { "type": "sendText", "text": "/clear", "submit": true }
}
}
text— literal string inserted at the cursor.submit(defaultfalse) — iftrue, submit immediately; iffalse, insert so the user can edit first.
Backward-compatible: existing string / null action values are unchanged.
Alternative Solutions
Terminal-emulator key macros (iTerm2 "Send Text", Kitty send_text, Ghostty text:) can send a string on a keypress, but they fire in every program in that terminal — the terminal can't tell which TUI is focused, so there's no way to scope the macro to Claude Code. An in-app binding is the only way to get a Claude-Code-only shortcut.
Priority
Low - Nice to have
Feature Category
Interactive mode (TUI)
Use Case Example
- I frequently nudge an agent forward by typing "Continue" and Enter.
- I add
"f5": { "type": "sendText", "text": "Continue", "submit": true }tokeybindings.json. - Pressing F5 now submits "Continue" without typing — only inside Claude Code.
Additional Context
Related: #62623 (slash commands don't submit under remapped submit keys) would exercise the same path as sendText with submit: true on a /command.
Environment: Claude Code 2.1.165, macOS (Darwin 25.5.0).
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗