"Find next" in Vim

Yktula picture Yktula · Jul 7, 2011 · Viewed 345.7k times · Source

To search forward in Vim for cake, I'd type /cake, but the cursor jumps to the first match when I press return. Is there a Vim command analogous to "find next"?

Answer

Xavier T. picture Xavier T. · Jul 7, 2011

It is n for next and N for previous.

And if you use reverse search with ? (for example, ?cake) instead of /, it is the other way round.

If it is installed on your system, you should try to run vimtutor command from your terminal, which will start a tutorial of the basic Vim commands.

Rob Wells advice about * and # is also very pertinent.