u/Swagasaurus-Rex

▲ 189 r/vim

10+ year user, learned today how to easy swap two selected sections

This is so simple I feel dumb for not seeing it earlier.

  1. visual mode select one part of text then d for delete

  2. visual mode select the text you want it to replace then p for paste

  3. go back to the original location and hit p for paste

that's it. Deleting the text places it in the register so you have it available in step 2. Replacing the text places it into the register, so you have it available in step 3.

For a decade plus I was adding extra steps like hitting Y or trying to avoid deleting the text so I have it available after I added the other, etc.

How many hours have I lost to not knowing this simple trick

reddit.com
u/Swagasaurus-Rex — 4 days ago