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?

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

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .