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.

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?

share|improve this question
    
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? –  Evan Teitelman Jun 16 '13 at 10:48
    
@EvanTeitelman:del in insert mode –  Cratylus Jun 16 '13 at 10:48
    
@Bernehard:Was not aware of this. Thanks! –  Cratylus Jun 16 '13 at 10:49
    
Is Enter supposed to be Escape? –  Evan Teitelman Jun 16 '13 at 10:51
show 1 more comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
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.