One way to automate repetitive tasks is to [record a macro] with a sequence of commands to repeat on every block.
For this particular case of swapping words, one useful technique is to use a visual selection for the second word and use a "put" command that will both replace it with the contents of the default register, but also send the overwritten contents to the default register. That way you can use the next put to include them in the first location.
In your case, assuming you're at the start of a line, for example on the "A" in "Alice". You could then use
dE to delete that word (leaving the whitespace intact.) Then
2W to skip the arrow and move to the beginning of "Bob". Use
vE to create a visual selection around "Bob". And then you can use
p to replace it with "Alice", while sending "Bob" to the default register. At this point,
0P will move back to the beginning of the line and put "Bob" where "Alice" used to be.
If you're recording a macro, end it with a
+ to move to the beginning of the next line. For example, recording it to the macro "a":
And then you can replay it with
@a, or replay it a large number of times (it will stop when there are no more.lines) with
Instead of a macro, you can also use this expression with a
:normal command with a range, which will repeat it for every line:
In general, the advantage of a macro is that you have visual feedback while you're recording it, so it's often easier to adapt to commands behaving in an unexpected way.
You can either handle the arrows through a separate global
:s command, or you can incorporate that into your macro recording too, after you switch both terms (to avoid messing with the default register in between.)
One other advantage of macros over
:s commands is that it's often easier to use them to implement changes that affect multiple lines. For instance, if your name pairs were separated in blocks of multiple lines and your "Alice" and "Bob" were in distinct lines, using a macro is often more straightforward than a
:s matching a multi-line block and trying to group multiple parts of it. As long as you're using general commands and anchors that will be valid on every block, you should be good to go.