0

If I have the following non-sense text:

Hi woman! What is your name? I know what you mean...  
Yeap.  
Yeap. Again :)  
Hi woman! What i s your name? I know what you mean...  
Yeap.  
Yeap. Again :)  
Hi woman! What is your name? I know what you mean...  
Yeap.  
Yeap. Again :)  
Hi woman! What is your name? I know what you mean...  
Yeap.  
Yeap. Again :)  

and I want to replace all occurences of woman with man I do:
Go my cursor to the first occurence of woman which is on the first line. I press * and all occurrences are highlighted.
Then I type cw and delete w and o and press ESC.
Then I press n and move to the next occurrence.
Then I type . and expect that wo will be removed. But only w is deleted. Why?

  • cw would delete the word woman in total. Why not :%s/woman/man/gc? – Bernhard Jun 16 '13 at 10:47
  • How are you deleting the w and o? What keys are you pressing? – user26112 Jun 16 '13 at 10:48
  • @EvanTeitelman:del in insert mode – Cratylus Jun 16 '13 at 10:48
  • Is Enter supposed to be Escape? – user26112 Jun 16 '13 at 10:51
  • @EvanTeitelman:Yes.I will correct OP – Cratylus Jun 16 '13 at 11:01
1

Instead of deleting the characters in insert mode, delete them in normal mode. Navigate to woman and type 2x to delete the first two characters.

Or, you can use substitution: :%s/woman/man/g.

|improve this answer|||||

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.