(macros)
Editing

Modal editing (helix)

Macros ships a Helix-style modal layer alongside evil. Where Vim is verb-then-motion (d w — delete a word), Helix is selection-first: a motion selects (the noun), then a verb acts on whatever is selected. w selects the word, d deletes it. And there can be many selections at once — every motion and verb applies to all of them.

Like evil, it's built entirely on the editor's keymaps — the Rust side only decides when plain keys are commands (Normal state) versus text (Insert state); every binding is Scheme and fully overridable. It is not on by default; Macros uses standard Emacs bindings unless you opt in.

Enable it from your init.scm (see Configuration):

(helix-mode)     ; opt in to Helix-style modal editing
(helix-disable)  ; turn it back off

Helix and evil are two different modal flavors — turn on one or the other, not both.

States

  • Normal — keys are commands, and motions leave a visible selection. This is where you start.
  • Insert — keys insert text. Enter with i / a / o (and capitals); leave with Esc.

Esc returns you to Normal — leaving select/extend, collapsing each selection to a bare cursor at its head. (It keeps any extra cursors you added, so a multi-cursor c / i / a survives.)

Motions (these select)

A motion moves the head of every selection. Word and line motions leave a selection behind; plain character moves collapse to a bare cursor.

Key Selects / moves
h j k l left / down / up / right
w / e / b next word / end of word / previous word
0 / $ start / end of line
x select the whole line — repeat to grow downward
g g / g e top / bottom of the file
g h / g l start / end of line

Selections

The core idea: build the selection you want, then act on it. These manage the selection set itself.

Key Action
v toggle select (extend) — motions then grow each selection instead of replacing it
C add a cursor on the line below
; collapse every selection to a bare cursor at its head
, keep only the primary selection (drop the rest)
Esc leave extend and collapse to a single cursor

With several selections active, every motion and every edit below runs on all of them at once. The renderer paints the primary selection and the secondaries distinctly.

Acting on the selection

The verb acts on whatever is selected. Right after a plain move — when a selection is just a bare cursor — these act on the single character under it, so they still do something useful.

Key Action
d delete the selection(s)
c change — delete, then enter Insert
y yank the selection(s) to the system clipboard
p / P paste after / before
r replace each selected character (r then a char)
u / U undo / redo

Yanks join multiple selections with newlines and copy to the system clipboard, so y then cmd-v in another app works.

Entering insert state

Key Action
i / a insert at the start / end of each selection
o / O open a line below / above

With multiple cursors, text you type replicates to every one of them.

Search and Ex

Key Action
/ search forward
n / N next / previous match
: Ex command — e.g. :%s/old/new/g

Scrolling

Key Action
C-d / C-u half-page down / up

Special buffers

Read-only buffers (Magit, grep, compile, occur, …) get a vim/helix-style motion overlay under helix-mode, mirroring evil's collection layer: j / k everywhere, plus the full read-only motion set in plain-text result buffers.

Try it

Run the in-editor Helix tutorial with C-h t and pick [helix] (or follow the [helix] link on the welcome screen).

Customizing

Helix bindings live in the "helix-normal" and "helix-insert" maps. Rebind exactly like any other key:

(define-key "helix-normal" "shift-q" 'kill-buffer)

Because it's all Scheme, you can add your own motions, verbs, and multi-selection commands. See Scripting with Steel.