Step 5 of 7

You don't even have to record!

You don’t even have to record!

Since a macro is really just keystrokes stored in a register, you don’t have to use Q to make one. Recording is a convenience — and it’s what you want most of the time — but it isn’t strictly necessary.

Instead, you can type the macro’s keystrokes out on a line, yank that line into a register of your choosing — say x — and then run the register with "xq. Helix parses the text the same way it reads back a recording, so special keys are spelled the way the register popup showed them: <esc> for Esc, <ret> for Enter.

Try it in the editor. Work through the checklist below. Write A!!!<esc> on a line of its own, yank the line into the x register with x and "xy, then move back to the headline and run it with "xq. Amazing!

  1. Write the macro out as plain text On a new line below, type A!!!<esc> literally — the macro, written out.
  2. Yank the line into the x register Select the whole line, then yank into the named register.
  3. Jump back to the headline Back to the top.
  4. Run the register as a macro Replay from the x register — the line's keystrokes run on the headline.
Write the macro out as plain text On a new line below, type A!!!<esc> literally — the macro, written out.

Next: Yank the line into the x register

Loading editor…