Macros

Record and replay keystroke sequences to automate repetitive tasks.

Recording

Start recording by pressing q followed by a register name:

qa     Start recording to register 'a'
q0     Start recording to register '0'

All subsequent keystrokes are recorded until you stop.

Stop recording by pressing q while not in a recording context:

q      Stop recording

Playback

Execute a recorded macro:

@[a-z]     Play macro from register 'a'

Repeat the last played macro:

@@         Repeat last macro

Compound repeats:

5@a        Play macro 'a' five times

Workflow Example

Record a macro to format a column as currency:

  1. Move to first cell in column.

  2. Press qa to start recording to register a.

  3. Press : then type format currency <Enter>.

  4. Press j to move down.

  5. Press q to stop recording.

  6. Press 10@a to apply to the next 10 cells.