Step 5 of 6

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 Open a line below with o, type A!!!<esc> literally, and press Esc.
  2. Yank the line into the x register Select the line with x, then yank it with "xy.
  3. Jump back to the headline Press gg.
  4. Run the register as a macro Press "xq — the line's keystrokes replay onto the headline.
Write the macro out as plain text Open a line below with o, type A!!!<esc> literally, and press Esc.

Next: Yank the line into the x register

Loading editor…