Vim Recall繁體中文

Yank to the next word

yw

Example

Normal 0 / 2
one two
Cursor on line 1, column 1

Copy from the cursor toward the next word start.

Vim registers

" Unnamed register
Characterwise · Uses Yank register 0saved
0 Yank register 0
Characterwisesaved
· space ⇥ tab ↵ line break
Before & after
Before
one two
Cursor on line 1, column 1

Vim registers

" Unnamed register
Characterwise · Uses Yank register 0saved
0 Yank register 0
Characterwisesaved
· space ⇥ tab ↵ line break
After
one two
Cursor on line 1, column 1

Vim registers

" Unnamed register Changed
Characterwise · Uses Yank register 0one·
0 Yank register 0 Changed
Characterwiseone·
· space ⇥ tab ↵ line break

Start in Normal mode. Cursor starts on o. Press yw; the unnamed register contains "one ".

Details & Vim help

Example replayed in Vim

Copy from the cursor toward the next word start.

The y operator stores the motion range in a register without changing the buffer. At a word start this commonly includes the following space; use yiw for the inner word alone.