Inspect and reuse a search
The technique
* searches for the word under the cursor. n repeats the search in the same direction.
Keys in this lesson
- n
- Next match.
- N
- Previous match.
- *
- Search for the word under the cursor.
- #
- The same, backward.
Before this lesson: Search for a destination.
More about this lesson
Repeat a search, reverse it, and search for whole words only.
n repeats your last search in the same direction and N goes the other way. After ?, n still searches backward. * searches forward for the whole word under the cursor and # searches backward. /cat can match catalog, but * on cat skips it. Check each match before you edit, in case it's one to leave alone.
Example
With three “ready” lines, /ready then Enter reaches the next one and n the one after that. N goes back to the previous match. Searching only moves the cursor.
Use Start over to try again.