Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vim

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?

like image 657
Rook Avatar asked Mar 23 '23 19:03

Rook


1 Answers

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.
like image 83
timss Avatar answered Apr 06 '23 11:04

timss