Files
clide/assets/keymaps/default.yaml
T
jpmschweitzerandClaude Opus 4.8 430189d714 keymap: support bare-modifier double-tap chords; double-Shift → quick-open (T-341)
The chord matcher couldn't represent a bare or double-tapped modifier:
KeyChord.parse required a base key, so `shift shift` failed, and JetBrains
"Search Everywhere" (double-Shift) was unbindable.

Design decision: search-everywhere aliases clide's existing quick-open
finder (not a new overlay) — bound across all four presets per the user.

Changes:
- KeyChord: a bare modifier name (`shift`, `ctrl`, `cmd`, …) parses as a
  modifier-free chord on that modifier's logical key, so parseSequence(
  'shift shift') yields a two-chord double-tap. Adds KeyChord.bareModifier
  and modifierForLogicalKey.
- ModifierTapTracker: headless, clock-injected double-tap detector. A bare
  modifier never forms a single chord; an intervening key breaks the gesture.
- app.dart global handler feeds bare-modifier KeyDowns to the tracker and,
  on a double-tap, resolves the 2-chord sequence via the new
  KeymapService.resolveSequence. The existing single-chord path is untouched
  (zero behavioural risk to normal keys).
- Presets: default/vim/vscode/jetbrains add `shift shift` → quickOpen.open.
  jetbrains header updated (the gesture is now expressible).

Tests: bare-modifier parse/equality/round-trip; tracker window/reset/
different-modifier/consume; each shipped preset resolves double-Shift to
QuickOpenIntent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 13:26:54 +02:00

100 lines
3.4 KiB
YAML

# clide default keymap.
#
# This is the baseline preset. Vim / VSCode / JetBrains presets are
# their own files (T-64/T-65/T-66) and replace bindings via the same
# YAML shape.
#
# Each binding:
# intent: <stable intent id> # see kernel/src/keymap/intents.dart
# keys: <chord> | [<chord>, ...] # `ctrl+shift+p`, `cmd+enter`, ...
# when: <when-clause> # optional; VS-Code-style boolean expr
#
# Identifiers in `when:` are scope flags published by producing
# services (e.g. `palette.open` when ClidePalette is mounted +
# visible). Missing flags evaluate to false.
name: default
bindings:
# -- Activation / focus -----------------------------------------------
# ActivateIntent has no when-clause: it dispatches via Actions.maybeInvoke
# against the focused context, so only widgets that opt in (ClideTappable's
# Actions wrapper) actually catch it. Text-input widgets handle Enter
# themselves first.
- intent: activate
keys: [enter, space]
- intent: dismiss
keys: escape
- intent: focus.next
keys: tab
- intent: focus.previous
keys: shift+tab
# Panel-to-panel cycling (sidebar → workspace → context).
# VS Code convention.
- intent: focus.nextPanel
keys: f6
- intent: focus.previousPanel
keys: shift+f6
# -- Command palette --------------------------------------------------
- intent: palette.open
keys: [ctrl+shift+p, meta+shift+p]
- intent: palette.selectNext
keys: [down, ctrl+n]
when: palette.open
- intent: palette.selectPrevious
keys: [up, ctrl+p]
when: palette.open
- intent: palette.accept
keys: enter
when: palette.open
- intent: dismiss
keys: escape
when: palette.open
# -- Quick open (fuzzy file finder) -----------------------------------
# ctrl+p / meta+p are free while the palette is closed; the palette
# only claims ctrl+p for selectPrevious `when: palette.open`, so this
# is conflict-free. Arrow/enter/escape inside the overlay are handled
# locally by the widget.
# `shift shift` (double-tap) is the JetBrains "Search Everywhere" gesture;
# clide aliases it to the quick-open finder across all presets (T-341).
- intent: quickOpen.open
keys: [ctrl+p, meta+p, shift shift]
when: "!palette.open"
# Nav stays on arrows/ctrl+n (not ctrl+p — that's the open chord and
# would collide while the overlay is up).
- intent: quickOpen.selectNext
keys: [down, ctrl+n]
when: quickOpen.open
- intent: quickOpen.selectPrevious
keys: up
when: quickOpen.open
- intent: quickOpen.accept
keys: enter
when: quickOpen.open
- intent: dismiss
keys: escape
when: quickOpen.open
# -- Find in files ----------------------------------------------------
- intent: findInFiles.open
keys: [ctrl+shift+f, meta+shift+f]
# -- Text scale -------------------------------------------------------
# On most layouts `+` is `shift+equal`; we bind both so users who
# think of it as Ctrl+Plus and users who hit Ctrl+= both work.
- intent: text.scaleIncrease
keys: [ctrl+equal, ctrl+shift+equal, meta+equal, meta+shift+equal]
- intent: text.scaleDecrease
keys: [ctrl+minus, meta+minus]
- intent: text.scaleReset
keys: [ctrl+0, meta+0]
# -- File (application menu, T-48) -------------------------------------
- intent: command:file.openFolder
keys: [ctrl+o, meta+o]
- intent: command:file.newWindow
keys: [ctrl+shift+n, meta+shift+n]