Rook
Rook

Reputation: 62568

When searching do "skip bottom, jump to the top" of the file

The title pretty much gives the gist away. Is there a setting that will, when using n and N stop the search when the bottom of the file is reached?

Upvotes: 5

Views: 978

Answers (1)

timss
timss

Reputation: 10270

Turn off search wrapping:

set nowrapscan

It'll give an error and stop at both the top and bottom of the buffer:

E384: search hit TOP without match for: set
E385: search hit BOTTOM without match for: set

From :h wrapscan: (default on)

Searches wrap around the end of the file.  Also applies to ]s and
[s, searching for spelling mistakes.

Upvotes: 8

Related Questions