1

An example:

Doe, John  

And I want:

John Doe

I cut Doe with D, and then 0 and then p

But what I get is this:

DJohn oe,  

How to do this right?

  • 1
    I do not fully understand your example. you cuttet John not Doe did you ? Your pasting problems seems to be a matter of using p instead you should use P to paste before. – Doktor OSwaldo Mar 10 '17 at 7:16
  • That is it. And I made a mistake. The cut should have been John of course. Thank you for your answer. – user3467407 Mar 10 '17 at 7:47
1

Lowercase 'p' will paste AFTER the cursor. Use a capital 'P' and it will end up BEFORE the cursor. It will not, however, insert a space, so you will end up with "JohnDoe,".

0

Assuming you are on the "D", you may also dtJA,Ctrl+R, ", which will leave you with John Doe, with the cursor at the end, to delete the rest.

An alternative would also be s/\v(\w+), (\w+)/\2 \1/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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