search

* / #

* searches forward for the whole word under the cursor; # searches backward. Zero typing needed — put your cursor on the identifier and hit *.

*  #  (normal mode)

Variations

Keystroke Effect
g* Search forward for word under cursor WITHOUT the whole-word boundary
g# Backward version of g*
3* Jump to the third occurrence of the current word

Examples

*

Highlight and jump to next occurrence of current identifier

#

Jump to previous occurrence

*N

* then N — mark current word without moving cursor

Gotcha

By default * anchors with \ so 'foo' won't match 'foobar'. Use g* if you want substring matches.

Related

← All Vim commands · Vim cheat sheet