Vim Recall繁體中文

Uppercase the current word

gUiw

Example

Normal 0 / 2
red blue
Cursor on line 1, column 2

Convert the inner word to uppercase.

Before & after
Before
red blue
Cursor on line 1, column 2
After
RED blue
Cursor on line 1, column 1

Start in Normal mode. Cursor starts on e. Press gUiw; the highlighted after-cursor shows the verified final position.

Details & Vim help

Example replayed in Vim

Convert the inner word to uppercase.

gU is an uppercase operator. iw chooses the whole word even when the cursor is in its middle, and leaves surrounding whitespace alone.