dangerman
dangerman

Reputation: 81

How to prevent Vim from jumping to first match when typing a search pattern?

When I start to search some keywords by / in Vim, the cursor always move to the first match automatically when I input each character.

This behavior confuses me, so What can I do to disable it?

Upvotes: 4

Views: 1475

Answers (1)

Enlico
Enlico

Reputation: 28416

You probably have incsearch set on.

You can set it off with :set noincsearch.

(Please, refer to :help 'incsearch' for more details.)


By the way, I want to give a personal suggestion: keep that option turned on.

Searching is a way of moving, but when incsearch is active, it's more versatile than any other movement because it gives you instant feedback of whether you're doing the movement you planned, and requires that you "confirm" the movement by pressing Enter. Just to give an example, see what happens if, with the cursor on (well, right before) the h in the following text, you hit d/i\@<!veEnter

one
two
three
four
five
six
seven

This is to say that / allows you to move to arbitrary places in the buffer and, via incsearch, it actually gives you feedback even before you actually commit to the move, thus allowing you to change the search pattern as you like, before hitting Enter.

Upvotes: 10

Related Questions