Emacs C-x z
can be used to repeat a single command.
To emulate Vim's dot command (.
), use
keyboard macros.
A typical workflow:
C-x (
to start recording a macro,C-x )
to end the recording.- execute the last recorded macro with
C-x e
(repeat withe
); execute until end of file (or error) withC-u 0 C-x e
(any other numeric prefix will do as well); - insert a 0-based counter in a macro with
C-x C-k C-i
(or set arbitrary counter base withC-x C-k C-c <number>
); - use search -- forward (
C-s
) and reverse (C-r
) -- to position the point; - can limit the macro application to a region with
C-x n n
(disable withC-x n w
), or viaM-x apply-macro-to-region-lines
More tricks listed in Emacs wiki.