keys: one table drives dispatch, help, footers, the rail and the wiki

keymap.ts lists every key with its context, action and help line.
actions.ts holds what each one does, typed against the table so a key
without an action, or an action without a key, does not compile.
modes.ts stacks the contexts (always > sheet > drawer > workspace >
writing > focused tile > special > global) and writes the two-key
pending logic once. App.svelte's 480-line onkeydown is now one call.

Help, the panel footers (a shared Keys component), the rail's keycaps
and Commands.md all read the table; the wiki gains the card and
scratchpad key tables.

One fix on the way: Ctrl-S in the editor no longer saves twice, which
could make the second save fail as "changed somewhere else".
This commit is contained in:
nvrl committed 2026-10-22 03:42:19 +02:00
1 parent 7f8a3816d3
commit 0eabcb2333
23 files changed
+1215 -1523

No files matched your search

+31 -1
View File
@@ -1,4 +1,4 @@
<!-- Generated by scripts/wiki.ts from web/src/lib/Help.svelte and web/src/lib/commands.ts. Edit that, then run `make wiki`. -->
<!-- Generated by scripts/wiki.ts from web/src/lib/keymap.ts and web/src/lib/commands.ts. Edit that, then run `make wiki`. -->
# Keys and commands
@@ -87,6 +87,24 @@ The first list is the inbox, the last list is done.
| `x · dd` | delete the card (asks y/N) |
| `q · Esc` | leave the special workspace |
### On the back of a card
| key | what it does |
| --- | --- |
| `j / k` | down / up the checklist |
| `gg / G` | first / last step |
| `Space · x` | tick the step, or untick it |
| `o` | a new step below the cursor — :task on the line |
| `r` | reword the step |
| `J / K` | move the step down / up |
| `dd` | drop the step |
| `e · i · Enter` | write the description, in the editor — :w writes it, :q or Esc in normal mode leaves |
| `a` | put on a label, or take it off — :label on the line, Tab offers the board's |
| `R · D` | rename the card, its due date |
| `H / L` | send the card to the list left / right |
| `gf` | the card's notes — a document, made on first use; q comes back |
| `q · Esc` | back to the board |
### In the agenda
| key | what it does |
@@ -101,6 +119,18 @@ The first list is the inbox, the last list is done.
| `T` | today's diary entry |
| `q · Esc` | leave the special workspace — a document opened from it comes back here on q |
### In the scratchpad
| key | what it does |
| --- | --- |
| `Q` | lower the scratchpad over whatever is on screen, or raise it again — :scratch <text> takes a note without it |
| `j / k` | down / up the notes, the one touched last on top |
| `o` | a new note, written straight away — it saves itself |
| `Enter · e · i` | write the note — Esc in normal mode, or :q, comes back to the notes |
| `K` | keep the note: a document in the folder being browsed, titled by its first line — :keep <title> names it |
| `dd` | drop the note (asks y/N) |
| `q · Esc · Q` | raise the scratchpad |
## Commands
A command takes a `!` for its forcing variant where one exists, the way vim's
+3 -2
View File
@@ -28,7 +28,8 @@ real data stays out of it.
| `src/vault.rs` | the vault's keys and file format |
| `src/sweep.rs` | the daily clean-up: trash, old versions, unreferenced uploads |
| `migrations/` | the SQLite schema, one numbered file per change |
| `web/src/App.svelte` | the keys |
| `web/src/lib/keymap.ts` | every key: where it is heard, what it is called, its help line |
| `web/src/lib/actions.ts`, `modes.ts` | what each key does, and which contexts hear it first |
| `web/src/lib/store.svelte.ts` | the client's state, and every call to the API |
| `web/src/lib/commands.ts` | the `:` commands |
| `web/src/lib/Help.svelte` | the `?` screen |
@@ -78,7 +79,7 @@ Three pages are generated by `scripts/wiki.ts`:
| page | read from |
| --- | --- |
| [Keys and commands](Commands.md) | `web/src/lib/Help.svelte` and `web/src/lib/commands.ts` |
| [Keys and commands](Commands.md) | `web/src/lib/keymap.ts` and `web/src/lib/commands.ts` |
| [Configuration](Configuration.md) | `.env.example` |
| [API](API.md) | the API section of `README.md` |