Type :
before searching: :/someStringtoFind
Enter. If the match isn't at the beginning of the line, press n
to go to the beginning of the match.
/someStringtoFind/
is an empty ex command with the range of lines /someStringtoFind/
(a 1-line range). The empty ex command means “jump to the end of the range”, so the command jumps to the next line containing a match for someStringtoFind
. You can drop the final /
if you have nothing to put afterwards.
:/someStringtoFind
drops you to the beginning of the target line. The search is stored in the search history, so n
brings you to the beginning of the next match, which is on the current line. There's an exception: if the match starts at the beginning of the line, then you're already at the beginning of the match, and n
would bring you to the next match. As long as the match doesn't span lines, $N
brings you to the beginning of the match reliably, if you don't mind the extra typing (or are writing a macro).
incsearch
is either on or off.g/
.