Here is how you could use a single keystroke to accomplish what you want (by matching capital Q):
map Q :s/:/;/g\|:s/;/:<Enter>j
Each time you press Q, the current line will be changed, and the cursor will move to the next line.
In other words, you can simply press Q several times to edit each subsequent line.
Explanation:
This will work globally on the current line:
:s/:/;/g
This will cause the first half-bell to return to the colon:
:s/;/:
@AlliedEnvy's answer combines them into one statement.
My map command assigns @AlliedEnvy a response to the Q character.
Another approach (which I would probably do if I only had to do it once):
f:; r ; ; .
Then you can click several times ; . until you reach the end of the line.
(Your choice to replace the half-hour is done by several of the community)
Explanation:
- f : - go to the first colon
- ; - go to the next colon (repeat the search in the line)
- r ; - replace the current character with a semicolon
- ; - repeat the last search in the line (again)
- . - repeat the last command (replace the current character with a semicolon)
In short:
- f x - moves to the next occurrence
x in the current line - ; repeats the last built-in search
source share