Cheatsheet Pages / Vim Cheatsheet

How to search in Vim — / ?, n N, and * #

Finding text forward or backward, hopping between matches, or searching for the word under the cursor.

Almost every entry was run headless in Vim 9.1 and the resulting file checked; the few entries a tiny build cannot run (system clipboard, persistent undo, the sudo save) were verified against Vim's own documentation instead.

/foo        " search forward for foo       ?foo  search backward
n           " next match                   N     previous match (opposite direction)
*           " search forward for the word under the cursor
#           " search backward for the word under the cursor
Vim Cheatsheet one-page card — commands that actually work
The full one-page card — Vim Cheatsheet. Get the complete cheatsheet on GitHub