The !!
history substitution gives a copy of the
previous command.
Most people use it to re-execute the previous command line.
Sometimes I want to repeat a cycle of two commands, one after the other.
To do that, I just type !-2
(second-previous command) over and over:
%vi plot
... %vtroff -w plot
... %!-2
vi plot ... %!-2
vtroff -w plot ...
You can cycle through three commands with !-3
, four commands
with !-4
, and so on.
The best part is that if you can count, you never have to remember what to do next. :-)
-