Next: , Previous: , Up: Common requests   [Contents][Index]

5.27 How do I repeat a command as many times as possible?

Use the repeat command (C-x z) to repeat the last command. If you preface it with a prefix argument, the prefix arg is applied to the command.

You can also type C-x ESC ESC (repeat-complex-command) to reinvoke commands that used the minibuffer to get arguments. In repeat-complex-command you can type M-p and M-n (and also up-arrow and down-arrow, if your keyboard has these keys) to scan through all the different complex commands you’ve typed.

To repeat a set of commands, use keyboard macros. Use C-x ( and C-x ) to make a keyboard macro that invokes the command and then type C-x e. See Keyboard Macros in The GNU Emacs Manual.

If you’re really desperate for the . command in vi that redoes the last insertion/deletion, use VIPER, a vi emulation mode which comes with Emacs, and which appears to support it.