Swapping Letters With Vim
Imagine you've typed 'recieve' instead of 'receive' in an RSpec test. This is will break things. I use this example because it's a typo I make frequently.
To swap the letters, move to the first letter ('i') and type xp
. This will swap that letter with the next letter. It's Vim for 'cut what's under the cursor, then paste it after the cursor.'
There are more complex ways to do this; this is the simplest I know of.
h/t Matt Polito
Tweet