krz/orgstar

A native macOS editor for org-mode files. editor org-mode swift

docs/plans/2026-10-05-doom-keys.md

2fa201330f61c801f777baa3f2943d49d8758cda
orgstar/docs/plans/2026-10-05-doom-keys.md rendered · source · history · blame · raw

23 lines · 2328 bytes

 1# Doom Keymap Implementation Plan
 2
 3> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
 4
 5**Goal:** A Doom preset: evil's modal editing with Doom's settings, Doom's leader and localleader keys for org, and evil-org's keys.
 6
 7**Architecture:** `OrgCore/Keymap/Vim.swift` is the modal engine, pure so it can be checked against evil: normal, insert, visual and visual-line states; counts and registers (`"a`–`"z`, append with capitals, `"_`, `"0`, the unnamed register on the clipboard); operators `d c y > < g~ gu gU` with motions (`h j k l w W b B e E ge gE 0 ^ $ g_ gg G f F t T ; , % { } n N * #`, C-d, C-u) and text objects (`iw aw iW aW` quotes, brackets, `ip ap`); `x X D C Y(=y$) p P J r ~ i a I A o O v V u C-r .`; evil-snipe's `s`/`S` (line scope, smart case); insert-state C-w and C-u; Doom's settings (`evil-start-of-line` nil, `evil-shift-width` = Org's tab width, Y to the end of the line). `o`/`O`/`cc` indent as `indent-according-to-mode` does in Org. The Doom preset is generated: the Emacs preset's `C-c`/`C-x`/meta/shift org keys copied into each state (with evil-org's `M-h/j/k/l` and insert-state `C-t`/`C-d`), then Doom's `SPC` leader and `SPC m` localleader for org, `TAB`, `RET` (`+org/dwim-at-point` as `OrgDwim`), `z a/c/o`, `g h/j/k`, `]h`/`[h`. The editor offers keys to the keymap for the current state, then to the engine, applies its edits as undo steps, draws a block cursor outside insert state, and reads `/`, `?` and `:` (`:w`, `:q`, `:wq`, `:N`, `:s`, `:%s`) in the echo area.
 8
 9**Tech Stack:** Swift 6.2 tools, Swift Testing; evil and evil-snipe from your Doom install as the oracle in batch Emacs.
10
11**Spec:** `docs/design.md`, "Keymaps" (Doom).
12
13## Global Constraints
14
15- Oracle: 125 key sequences run by evil (+ evil-snipe) in batch Emacs on an Org buffer; text, point and state compared.
16- Not yet: macros (`q`, `@`), marks, jumps (C-o/C-i), `gv`, block visual (C-v), evil-surround, evil-commentary, evil-org text objects (`ae`, `iR`…), numbered delete registers.
17
18---
19
20- [x] `Vim`; oracle.
21- [x] Doom preset; `OrgDwim`.
22- [x] Editor routing, block cursor, prompts, ex commands; editor tests.
23- [x] Commit "Doom keymap".