Here is how you could use a single keystroke to do what you want (by mapping capital Q):
map Q :s/:/;/g\|:s/;/:<Enter>j
Every time you press Q the current line will be modified and the cursor will move to the next line.
In other words, you could just keep hitting Q multiple times to edit each successive line.
Explanation:
This will operate globally on the current line:
:s/:/;/g
This will switch the first semi-colon back to a colon:
:s/;/:
The answer by @AlliedEnvy combines these into one statement.
My map command assigns @AlliedEnvy's answer to the capital Q character.
Another approach (what I would probably do if I only had to do this once):
f:;r;;.
Then you can repeatedly press ;. until you reach the end of the line.
(Your choice to replace a semi-colon makes this somewhat comfusing)
Explanation:
- f: - go to the first colon
- ; - go to the next colon (repeat in-line search)
- r; - replace the current character with a semi-colon
- ; - repeat the last in-line search (again)
- . - repeat the last command (replace current character with a semi-colon)
Long story short:
- fx - moves to the next occurrence of
x
on the current line
- ; repeats the last inline search