When I'm searching my document with /
when the next match line is off screen, the cursor jumps down so that the matched line is the very last line in the window. For example, if I'm searching for countWordsWithMap
in this sample file, it looks like this:
Is there any way to make it so the cursor jumps to the line where the match is found, but the window moves below that by a certain amount? For example, if I set the value to 10, the cursor should move to the match on line 59, but the window would jump to line 69, like this:
Basically, I always want the few lines below the match to be visible, unless the match is at the end of the file.
zz
is your friend (see:h zz
).