User guide / Key bindings

Macros

Development reference · View source

Macros live in the Space m namespace.

KeyAction
Space m mStart recording the default macro, or stop the recording
Space m M then a registerStart recording a macro under that register
Space m rReplay the default macro; accepts a count
Space m R then a registerReplay that macro; accepts a count
Space m lList every recorded macro; Enter replays the selected one

Recording:

  • Space m m starts recording and the same keys stop it. The stopping keys are not recorded.
  • Space m m records into the default macro, register @. Space m M asks for a register first; any printable key names one.
  • Only one recording runs at a time. Starting a second is refused rather than replacing the first.
  • A recording captures raw input in arrival order and replays it through the same dispatch, so a replay does exactly what the typing did.

Example: add a semicolon to the end of several lines.

  1. Space m m — start recording.
  2. A ; Escape j — append ;, return to Normal, move down.
  3. Space m m — stop.
  4. Space m r — replay on the next line. It accepts a count.

Replaying:

  • Replay runs between frames, not by holding the input loop.
  • Escape or Ctrl-c cancels the remaining work. Inputs already run are kept, because a macro may have done things that cannot be rolled back.
  • While work remains, the interaction line shows progress and the cancel keys.

Safety limits (reaching any of them stops the whole replay):

  • Direct and mutual recursion are refused, naming the register chain.
  • Distinct macro calls may nest up to 16 levels.
  • One top-level replay has a 10,000-unit budget shared by raw key events, characters of literal text, counted repetitions, and nested macros. Counted commands expand between frames.
  • Range operations whose exact meaning cannot be split are limited to 128 repetitions in one recorded input, and refused before taking effect when larger.