Vim Scoops / Lessons / Search

How to search in Vim

Press /, type what you're looking for and press Enter. Press n for the next match and N for the previous one.

The keys

KeysWhat they do
/wordSearch forward
?wordSearch backward
n / NNext / previous match
*Search for the word under the cursor
:nohClear the highlighting

Searches wrap around at the end of the file, so n keeps cycling through every match.

Add \c to ignore case for one search (/mint\c), or put set ignorecase smartcase in your vimrc to make it the default.

Related

Want all of Vim, in order? Vim Scoops is a free game that starts at h j k l and builds up to macros.

Play the full game