Skip to content

feat: keyboard shortcuts for prompts#81

Open
adamatan wants to merge 1 commit into
simion:mainfrom
adamatan:feature/prompt-keyboard-shortcut
Open

feat: keyboard shortcuts for prompts#81
adamatan wants to merge 1 commit into
simion:mainfrom
adamatan:feature/prompt-keyboard-shortcut

Conversation

@adamatan

@adamatan adamatan commented Jul 10, 2026

Copy link
Copy Markdown
Contributor
prompt-quick-fire.mp4

Summary

  • Add per-prompt keyboard shortcuts: a leader-key sequence (R, then a
    letter/number) fires a saved prompt directly into the focused agent,
    or opens a destination picker when it can't auto-resolve one.
  • Add a quick-fire command palette (Shift+Cmd+R) for browsing and firing
    prompts without memorizing their assigned key.
  • Shortcut keys can be overridden per-prompt in Settings > Prompt Library;
    unassigned prompts auto-fill free 1-9/a-z slots, stable across
    enable/disable toggles.

Fixes #80

Test plan

  • npm test (vitest): 145/145 passing
  • npx tsc -b: clean
  • Manual: press leader key + assigned key with an agent focused,
    confirm prompt fires into that agent
  • Manual: fire a prompt with no live agent focused, confirm the
    destination dialog appears and picks correctly
  • Manual: open the palette (Shift+Cmd+R), fire a prompt by search
  • Manual: assign/clear an override key in Settings > Prompt Library,
    confirm it persists across restart

🤖 Generated with Claude Code

@adamatan adamatan changed the title feat: prompt-triggered keyboard shortcuts and quick-fire palette feat: keyboard shortcuts for prompts Jul 10, 2026
@adamatan

Copy link
Copy Markdown
Contributor Author

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>
@adamatan adamatan force-pushed the feature/prompt-keyboard-shortcut branch from 82832af to a323c59 Compare July 10, 2026 19:28
@simion

simion commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Love the prompt quick fire palette. I would suggest assigning Option+Cmd+P to it.
A similar shortcut we have: option+cmd+b (toggle right sidebar).

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

@adamatan

Copy link
Copy Markdown
Contributor Author

@simion are you open to dedicating ⌘+p and ⌘+shift+p to prompts?
⌘+p is assigned to file search/file open, and we can change this shortcut to ⌘+o.

@simion

simion commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Current shortcuts are half Conductor-like , half sublime-like. I'll think about it

@simion

simion commented Jul 11, 2026

Copy link
Copy Markdown
Owner

@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.

@MHohlios

Copy link
Copy Markdown
Contributor

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
https://zed.dev/docs/key-bindings

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.

@adamatan

Copy link
Copy Markdown
Contributor Author

@MHohlios great point. Choosing a keymap is a good idea and Ic an add it as a separate PR.
However, we need to choose a default. We can let the user choose at onboarding (which is an extra step that slows down time to first agentic interaction), or make the decision ourselves.

WDYT?

@simion

simion commented Jul 11, 2026

Copy link
Copy Markdown
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Per-prompt keyboard shortcuts + quick-fire palette for the Prompt Library

3 participants