Learn Vim / How to Search in Vim (and Edit at the Match)

How to Search in Vim (and Edit at the Match)

The answerPress /, type the pattern, press Enter. The cursor jumps to the first match — then edit right there.

Try it on a real buffer

Somewhere in this file hides the word “hello”. Press / then type hello, press Enter to jump to it, then delete the word with daw.

Searching beats scrolling every single time.
When a file grows to thousands of lines,
your eyes are the slowest tool you own.
Type a slash, type a few letters, press Enter,
and the cursor teleports across hello the file.
Practice until reaching for search is a reflex.

Canonical solution: /hello Enter, then daw · par: 8 keystrokes (vimgolf rules — every keypress counts).

Why it works

/pattern searches forward, ?pattern searches backward. daw = delete a word — it grabs the word plus its surrounding space, so the sentence stays clean.

Variations

KeysWhat it does
/patternsearch forward
?patternsearch backward
n / Nnext / previous match
*search for the word under the cursor
:nohclear match highlighting

Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “Search and destroy” mission takes about a minute.

Practice free — no signup →

Keep going