Vim Recall繁體中文

Yank the current word

yiw

Example

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

Copy the inner word without surrounding spaces.

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 2

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 n. Press yiw; the unnamed register contains "one".

Details & Vim help

Example replayed in Vim

Copy the inner word without surrounding spaces.

Combine y with iw to copy the complete word from anywhere inside it. The buffer stays unchanged.