How do you move the cursor to the other end of a visual selection?
o in visual mode
While in visual mode, press o to move the cursor to the opposite end of the selection.
o in visual mode
While in visual mode, press o to move the cursor to the opposite end of the selection.
"adiw then move, "aP and diw
Delete the first word into register a with "adiw, move to the second word, paste register a before with "aP, then delete the remaining original.
cx{motion}
The vim-exchange plugin by Tom McDonald provides the cx operator to swap two arbitrary text regions.
plugins #plugins #exchange #editing #text-objects #refactoring