This is another great advantage which makes me fall in love with vi, just makes your life much simpler.
- Press q to enter the recording mode
- Press any lowcase character, such as "a", as the name of this command sequence. Now it will start recording, as the message (--recording--) appears at the bottom of the screen.
- do any fancy work with vi commands
- Press q to exit and save this sequence of command
- Move cursor to any other proper position to replay command, press @ and the command name ("a", in this example), then miracle happens!
Welcome to the magical world!