Vim Recall繁體中文

Select the current or next match

gn

Example

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

Select a match of the last search pattern, searching forward.

Before & after
Before
red blue red green red
Cursor on line 1, column 1
After
red blue red green red
Cursor on line 1, column 3 · Character selection

Start in Normal mode. The previous search pattern is red. Vim selects the matching text in the requested direction.

Details & Vim help

Example replayed in Vim

Select a match of the last search pattern, searching forward.

In Normal mode, gn selects the match under the cursor or searches forward for one. With an operator it operates on the match. Its forward direction does not depend on whether the last search used / or ?.