features / F20-keyboard / design.md

F20 design

Written against spec.md in this folder, from origin/cursor/reading-shell-specs-6322. That branch is not merged. The shortcuts in this spec are built. The key list with scopes is specs/contracts/keymap.md. This design leaves unbound every key the contract marks as not started.

Review keys are not bound: G then I, G then T, G then M, review M, review R, review C, review D, review E, and J and K. C outside a dialog creates a page. E on a page starts editing. Those two collisions are recorded in the keymap contract and are not given review handlers here.

Modules

ModuleRole
components/use-editor-keys.tsThe window listener for the shell chords and the plain keys
components/shortcut-help.tsxThe dialog labeled "Shortcuts"
components/settings-host.tsxCommand-, toggles settings, and Escape closes it
components/share-host.tsxEscape closes the share sheet
components/page-search.tsxArrows and Enter inside search
components/editor.tsxSwallows Command-S and Command-/ in the source editor so the window listener still owns them
components/block-editor/extensions.ts/ opens the block insert menu. [[ opens the page picker
components/block-editor/commands.tsThe items that menu inserts. The catalog width is F09, not this feature
components/draft-store.tssetMode, which Command-/ and E call

Data shapes

A binding is a key, a scope, and an action. The scopes used here are global, document, editor, and dialog, as named in the keymap contract. Review scope has no handler.

type Scope = "global" | "document" | "editor" | "dialog";

type Chord = {
  key: string;
  meta: boolean;
  scope: Scope;
  runsWhileTyping: boolean;
};

meta means Command or Control. The help dialog says "On Linux and Windows, Ctrl is the modifier."

KeysScopeAction
Command-K or Control-KglobalOpen page search and close shortcut help, including while typing
Command-/ or Control-/globalSource if the mode is not source. Editing if the mode is source. Does not return to viewing
Command-\ or Control-\globalToggle the outline choice, including while typing
Command-S or Control-SdocumentSave a version of the open page. No page, no save
Command-, or Control-,globalToggle the settings dialog, including while typing
?globalOpen shortcut help and close page search. Suppressed while typing. Not suppressed by an open dialog
EdocumentStart editing. Requires a page. Does not turn editing off. Suppressed while typing or while a dialog or menu is open
CglobalOpen the file column and start a new page in the open page's folder, or at the top level when no page is open. Suppressed while typing or while a dialog or menu is open
EscapeglobalClose page search, shortcut help, and the phone file drawer. Settings and share close on their own listeners
/editorOpen the block insert menu at the start of a block that is not a code fence
[[editorOpen a picker of up to 8 pages whose title or path contains the text typed after [[

C and E also require that neither Command nor Alt is held. Shift is ignored, so c and C both match, and e and E both match.

The help dialog lists these ten rows, in this order: Search pages (⌘K), Switch between blocks and Markdown source (⌘/), Show or hide the outline (⌘\), Start editing (E), Insert a block while editing (/), Link to a page while editing ([[), Create a page (C), Save a version (⌘S), Open settings (⌘,), Show this list (?). It also shows "On Linux and Windows, Ctrl is the modifier." It does not list the review keys.

State

The listener reads the current mode, the open page id, and whether a dialog or menu is open (.overlay or .menu). It does not store a keymap of its own. Outline open, search open, and help open are the shell state in components/workspace.tsx. Settings open is the state in SettingsHost. Mode is markdown-kb:mode (F09).

Command-/ from viewing opens source, not editing. The Edit control, not this chord, returns to viewing. That split is F09-REQ-002 and F09-REQ-003. This feature requires the chord's half of it.

The / menu and the [[ picker are the editor suggestions that already ship. F09-REQ-021 and F09-REQ-022 are a narrower catalog and a version pin. Those are not this feature. This feature requires that the keys open the menus, and that the page picker offers at most 8 pages.

Contracts

Every row above is the built row in specs/contracts/keymap.md. The review table in that contract stays not started, which is F20-REQ-014. Dialog sizes for shortcut help follow the search dialog in specs/contracts/tokens.md: up to 520px, inset 32px.