Tip #47: Swapping characters, words and lines
tip karma |
Rating 11/13, Viewed by 1298
|
created: |
|
March 13, 2001 13:08 |
|
complexity: |
|
basic |
author: |
|
Anonymous |
|
as of Vim: |
|
5.7 |
To swap two characters or lines, use the following commands:
xp - delete the character under the cursor and put it afterwards.
(In other words, it swaps the characters.)
ddp - delete the current line and put it afterwards.
(In other words, it swaps the lines.)
Unfortunately there is no universal solution to swap two words.
You may try the following ones, but don't expect too much of them:
dawwP - delete the word under the cursor, move forward one word
and put it back after the cursor. (In other words, it
swaps the current and following word.)
dawbP - delete the word under the cursor, move backward on word
and put it back after the cursor. (In other words, it
swaps the current and preceeding word.)
<<Win32 binaries with perl, python, and tcl |
Moving around >>
Additional Notes
|