Here is a trick you can use in VI if you need to repeat an action multiple times. Imagine you have this file:
You want to change it to read "Hello world!" Here is what you can do in VI:
- Go to the first occurrence of what you would like to have changed.
- Enter "q" to initiate a recording.
- Enter a letter or digit to save the recording under, like "a" or "1".
- Do the actions you would like to repeat.
- Enter "q" again to stop and save the recording.
- Go to the line where you would like to start running the saved recording/macro.
- Enter "@" followed by the letter of digit you have saved the recording under, like "a" or "1".
So, now you have learned what this (annoying) "recording" option can be used for!