Today I Learned

hashrocket A Hashrocket project

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

See More #vim TILs
Every developer at Hashrocket is a Vim expert. Check out our development environment, Dotmatrix, and if you are in Chicago, come to the Vim Chicago Meetup hosted at our Chicago office.