Emacs Repeat Command

Do It Again

Emacs has a repeat command that executes your last command whatever it was. Its fairly easy to learn and use.

Ctrl-x z

Run that and it should re-run whatever command you carried out before.

One of the nice things about repeat command, each time you press z, it does it again.

Say you delete four lines, do Ctrl-x z, then keep pressing z. Each time another line disappears.

Press z ten times and ten lines disappear.


You only need press Ctrl-x once, then press as many 'z' as you like. You don't need to press Ctrl-x again. Once is fine.

Its easy to hit Ctrl-z, which minimizes Emacs. One solution is to remap Ctrl-z to also run repeat command.