tags:

views:

34

answers:

3
${BASE}/test/  other_consecutive_none_empty_characters

If the cursor is under the $ sign ,how can I copy "${BASE}/test/" as a whole and paste it somewhere else in vim ? I don't want to use the human-eye-letters-counting solution if that is the only solution I'd rather like to hit the keyboard charcter by charcter .

+1  A: 

yt , i.e., y, t, followed by space. t can be thought of as "till". You can select with vt, delete with xt, etc.

Alok
+2  A: 

y Yank W WORD:

yW

From :help W:

A WORD consists of a sequence of non-blank characters, separated with white space. An empty line is also considered to be a WORD.

John Kugelman
No matter how long you use vi, there is always something you didn't know :)I have been using w like a sucker all this time!
Gord
@Gord :totally agree
Haiyuan Zhang
Using `W` will get you the space after the word too - see Pavel's answer!
Jefromi
+7  A: 

yE would be the most correct solution. y means "yank" (i.e. copy to buffer), and E - "up to the end of the WORD", which is, up to the next whitespace character.

Personally, I prefer typing yiW - yank inner WORD. It works the same way, but the cursor may reside anywhere inside the WORD, not just on the dollar sign.

Pavel Shved
+1, better than mine.
Alok