How do I exchange (swap) two characters or words or lines?

You can exchange two characters with the “xp” command sequence. The ‘x’ will delete the character under the cursor and ‘p’ will paste the just deleted character after the character under the cursor. This will result in exchanging the two characters. You can exchange two words with the “deep” command sequence (start with the cursor in the blank space before the first word). You can exchange two lines with the “ddp” command sequence. The ‘dd’ will delete the current line and ‘p’ will paste the just deleted line after the current line. This will result in exchanging the two lines. All of the above operations will change the “ unnamed register. You can use the “:m +” ex command to exchange two lines without changing the unnamed register.

Read free Software Algorithms and Computer Science Books by CodeAhoy Learn.

Introduction to Recursion and Backtracking

Sorting Algorithms

Introduction to C Programming Language

And More...

Speak Your Mind