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'm working with the vim editor and I found y,yw respectively to copy a line and a word but how can I do the following task in vim?

www.pack.google.com

From this line how can I copy and paste ack.goo using vim editor?

share|improve this question

2 Answers 2

up vote 10 down vote accepted

Move cursor under a, press v, use arrow key to select until o, press y. Then move cursor to where you want to paste the text, press p. Done.

share|improve this answer
    
thanks buddy your first answer bingo. –  mr_eclair Aug 4 '11 at 15:23
3  
Try vimtutor as your first step learning vim (: –  Daniel Le Aug 4 '11 at 15:25
    
ye I'm gonna refer that soon. –  mr_eclair Aug 4 '11 at 15:27
1  
Why not do this?0fay2fo.Though visual selection is better if you don't wanna count,but always rely on f<character> –  bollovan Aug 6 '11 at 16:45
    
arrrrows are evil! :) –  takeshin Aug 11 '11 at 9:13

y is followed by a movement, so, like you said, yw will copy a word because w is the movement that takes you forward one word.

You can also type a number before an action or before a movement (or both, I suppose, but that multiplies the numbers and that just seems silly) to repeat the action/movement that many times, so to yank 5 words you can type 5yw or y5w.

In your example, l moves the cursor left, so if the cursor is on the "a" you want, you can do y7l or 7yl.

share|improve this answer
    
Us vi oldtimers are always counting chars, words or lines because we often use things like y7l, c3w or d5d. –  Michael Dillon Aug 11 '11 at 5:18

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.