Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


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

share|improve this question
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
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
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


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.