Add the key engine, which-key and keys.toml
Keys now work the way vim reads them. A key press becomes a Key (with vim notation for writing keys: `<C-w>v`, `<leader>c`, `<<`), and the engine collects counts (`12j`), registers (`"+p`), sequences (`gg`), operators with their targets (`dd`, `dab`, `2d3d` multiplies to 6) and keys that take a character (`ma`, `'A`), then hands over a typed Command. Every command has a name and a help text in one table, and the default keys live in one table per place they work (motions, normal, canvas, visual, move, connect, lists). keys.toml changes keys per section, with the leader configurable and "nothing" to unbind. Each mistake is skipped and reported in words, with a suggestion for mistyped command names, and a key that would hide a longer one is reported too. The which-key popup reads the same tables: it shows what can follow the keys typed so far, in skyshift's look and place, with the leader menu instant and other prefixes after 300 ms. The mouse reader turns button events into presses, double-clicks, drags and scrolls. `Direction` moved from the glyphs to the model, since input needs it too. The canvas example now runs on all of this, with a two-line keys.toml of its own that makes `q` quit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
e097e53a85
commit
c2e62de172
21 files changed
+2501
-204
No files matched your search
@@ -335,10 +335,12 @@ which_key_delay = "300ms"
|
||||
max_node_width = 30
|
||||
glyphs = "unicode" # "ascii" for fonts without box-drawing characters
|
||||
|
||||
# keys.toml
|
||||
# keys.toml: sections motions, normal, canvas, outline, note, visual, move,
|
||||
# connect, list; commands by name (src/input/command.rs); "nothing" unbinds
|
||||
leader = "<Space>"
|
||||
[normal]
|
||||
"<Space>x" = "delete-branch"
|
||||
"x" = "nothing"
|
||||
[canvas]
|
||||
"H" = "previous-document"
|
||||
|
||||
|
||||
Reference in new issue
Block a user