Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I like the fact that I've memorized ddp for switching two lines (i.e. dd deletes the line and then p puts it back '1 higher').

Is there are similar set of keystrokes for switching 2 characters so that wsih would become wish?

share|improve this question
    
Line swapping, character swapping and word swapping tips in vim can be found at vim.wikia.com. –  Thor Sep 15 '12 at 14:16
add comment

1 Answer

up vote 14 down vote accepted

The answer turned out to be xp, just not the windows kind ;)

share|improve this answer
    
Yes, xp transposes two characters in vi. –  maxschlepzig Sep 14 '12 at 18:22
4  
x - eat the character under the cursor (and put it in the paste buffer); p - paste the buffer after the position of the cursor (which has advanced one character in the text). –  Herman Torjussen Sep 14 '12 at 19:09
1  
Just curious. What's the "windows kind"? –  Stephane Chazelas Sep 14 '12 at 19:57
3  
    
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.