myelin
What if: every Go program had keybindings as good as an editor's?
Status: released, used in plx
Editors solved keybindings a long time ago. Most terminal programs still hard-code
their keys in a switch: no overrides, no menus, and ctrl+d means something
different in each one. I hit this in plx, so I took the editors' model and made it
a Go library:
- keys bound in contexts over what's focused, as cel-lite expressions; the deepest context wins
- the user's config as a layer over your defaults
- sequences like
g gand a leader key, with which-key menus as data - no UI and no files, so it works the same in a TUI, a GUI or on a phone
From VS Code it takes the layering, from Zed the contexts, from Spacemacs the leader menus and from Ghostty the key names.