Vim: apply macro to entire file

Input:

username1
username2
username3

Target Output:

[email protected]
[email protected]
[email protected]

Vim Commands:

gg0                # move cursor to first char in file
[email protected]   # record actions into macro q, then undo
:%norm! @q              # apply macro q to entire file
:wq                     # save and exit

 

Leave a comment