feat: keyboard shortcuts for prompts#81
Conversation
|
Resolving the conflicts (worksapce/task) |
Adds per-prompt keyboard shortcuts (a leader-key sequence, e.g. R then a letter/number) that fire a saved prompt straight into the focused or a picked agent, plus a command palette (Shift+Cmd+R) for browsing and firing prompts without memorizing keys. - src/lib/shortcuts.ts: effectiveTriggerKeys() reserves per-prompt overrides first, then auto-assigns free 1-9/a-z slots stably across enable/disable toggles. - src/lib/promptFire.ts: shared fireOrPickDestination() logic (focused vs. live-agent-tab resolution) extracted so the leader-key shortcut, the palette, and the dropdown all resolve destinations identically. - src/hooks/useShortcuts.ts: leader-key arm/disarm state machine, capture phase + stopImmediatePropagation to intercept the follow-up key before xterm/CodeMirror, 2s timeout and Escape to cancel. - src/components/dialogs/PromptDestinationDialog.tsx: modal picker extracted out of UnifiedBar.tsx for choosing a destination when a prompt can't auto-resolve one. - src/components/dialogs/PromptPalette.tsx: non-modal command palette for browsing/firing prompts by name. - src/store/prompts.ts, src/store/ui.ts: persist per-prompt triggerKeys and add promptFire/palette UI state. - src/components/settings/PromptLibrarySection.tsx: shortcut recorder UI for assigning/clearing per-prompt override keys. - docs/shortcuts.md: document the new shortcut system. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
82832af to
a323c59
Compare
|
Love the prompt quick fire palette. I would suggest assigning Option+Cmd+P to it. Cmd+shift+R usually is "find and replace in files" and I will implement all these code editor / ide features inside termic, so i don't need another external code editor anymore to do my code navigation and fixes. I would have proposed cmd+shift+P but that's the command pallete for sublime/vscode/other similar code editors. Now that i think of, we might change the command palette default shortcut to cmd+shift+P because current cmd+k is "clear terminal/agent output" in any terminal software i can think of, and i personally use it a lot. What's your take on this? @MHohlios any input on this from you too would be appreciated :D |
|
@simion are you open to dedicating ⌘+p and ⌘+shift+p to prompts? |
|
Current shortcuts are half Conductor-like , half sublime-like. I'll think about it |
|
@adamatan Termic is a direct conductor replacement, so I want to keep this as easy as possible for conductor users to switch. Need to think this really well. However it seems like conductor has also got a lot of inspiration from code editors like sublime or vscode. At the same time, there are way more sublime/ vscode users than conductor. I'll think this through really well and come up with a proposal here asap. |
|
Honestly I'm the wrong guy to ask about specific keys — I barely use shortcuts — so I'll defer to you all on ⌘K vs ⌥⌘P and friends. That said, I went poking around the code and the good news is this debate is already lower-stakes than it feels: SHORTCUT_DEFS is a real command registry with per-user overrides, conflict detection, and a rebinding UI, and this PR wires the leader key + palette into it. Nothing here is a one-way door — anyone can remap anything. Which makes me think the Conductor-vs-Sublime/VS Code question doesn't need a winner. Ship keymap presets instead; a preset is just a named BindingMap over the registry you already have, plus a picker on first run or in Settings ("Conductor / VS Code / Sublime"). Everybody keeps their muscle memory and the defaults can be whatever you think is best. VS Code (base keymaps) and Zed (base_keymap) both landed on this for exactly this reason: https://code.visualstudio.com/docs/configure/keybindings Another side thought here: Overrides currently live in localStorage only. I'd love to see them in a real file ~/.config/termic/keymap.json or similar, the way Zed does it — so bindings survive a webview cache wipe and can be versioned/synced with dotfiles. |
|
@MHohlios great point. Choosing a keymap is a good idea and Ic an add it as a separate PR. WDYT? |
|
Keymaps were my first thought, not sure I want the maintenance burden and cognitive load for each new keybinding added vs a good opinionated one. But your arguments are spot on @MHohlios Let me study all these key bindings tonight and decide if we go down the keymaps path or properly choose a single set. Users can override them anyways. |
prompt-quick-fire.mp4
Summary
letter/number) fires a saved prompt directly into the focused agent,
or opens a destination picker when it can't auto-resolve one.
prompts without memorizing their assigned key.
unassigned prompts auto-fill free 1-9/a-z slots, stable across
enable/disable toggles.
Fixes #80
Test plan
npm test(vitest): 145/145 passingnpx tsc -b: cleanconfirm prompt fires into that agent
destination dialog appears and picks correctly
confirm it persists across restart
🤖 Generated with Claude Code