Apps

Keys

# Key Binding Manager Browse and edit the key bindings of every app in the workspace. Bindings are shown as a two-column grid (chord → command) and are grouped per app, and per mode within an app — the editor's vi/emacs driver keysets surface as modes. Changes write through to the keymap registry immediately (open panels pick them up live via pub/sub) and persist to `.deft/keytable.dft` on save. ## Layout - Header — current view: `Keys — All (119 bindings)` or `Keys — editor/vi (1 bindings)`. - Grid — one row per binding. Chords you have overridden are highlighted in yellow; bindings disabled outright show a dim `(disabled)` in place of a command. In the All view the Key column carries the full `app/mode/chord` path. - Status bar — position indicator (`[2/3]` = app 2 of 3, `[All]`) and the last action. ## Key Bindings | Key | Action | |-----|--------| | `Up` / `Down` | Move cursor | | `Page Up` / `Page Down` | Scroll by page | | `Home` | Jump to top of list | | `Enter` | Edit the selected binding's command | | `D` | Disable the selected binding (unbinds the key) | | `R` | Restore the selected binding to its package default | | `N` | Add a new binding (captures the next keypress) | | `Ctrl+S` | Save overrides to `.deft/keytable.dft` | | `Ctrl+Left` / `Ctrl+Right` | Cycle app: All → app1 → app2 → … → All | | `Ctrl+Up` / `Ctrl+Down` | Cycle mode within the selected app (default/vi/emacs/…) | ### Editing a Command With a binding selected, `Enter` (or a click on the selected row) opens the inline editor at the bottom of the panel: | Key | Action | |-----|--------| | `Enter` | Commit — an empty command unbinds (disables) the chord | | `Escape` | Cancel | ### Adding a Binding Press `N`, then the key combination to bind (`Ctrl+F9`, plain `x`, …). Modifier-only presses are ignored; `Escape` cancels the capture. The command editor opens with the new chord pre-filled. ## Modes Apps may ship more than one keyset. The editor's modes are its input drivers — `default`, `vi`, `emacs` — and the active keyset follows the driver the editor is using. At keypress time apps resolve bindings mode-first with fallback to `default`, so the vi/emacs sections hold only the deltas that differ from the base map. Single-keyset apps (log, files, …) show just `default`. ## Persistence Nothing touches the disk until `Ctrl+S`. Saving diffs the live keymap against the per-package defaults (each app's `keys.dft`) and writes only your changes as a nested map:
%{
    :editor %{
        :default %{
            "alt-5" "cmd-md-fold-level-5"
            "f6" nil } } }
A `nil` command is a disabled default — it round-trips, so a binding you removed here stays removed after restart. `R` (reset) re-reads the package default at any time. ## Rebinding from Scripts The same registry is available everywhere via the `keymap/*` stdlib functions:
[keymap/set "editor" "vi" "ctrl-s" "cmd-save-all"]
[keymap/lookup "log" "default" "f"]     # mode → default fallback
[keymap/scan "editor"]                  # %{ :vi %{ :ctrl-s "cmd-save-all" } … }
Changes publish on the `"keymap"` pub/sub topic; the editor re-merges its keymap live, and consumer apps read lookups straight from the shared registry on each keypress.