5

If i press a bunch of key sequences like this:

/term<cr>

and there are five matches on the screen currently, i will have to press n five times to see the next search result that is not on the screen. Is there a single key (or two) that I can press to emulate pressing n five times in the situation?

4 Answers 4

10

Ctrl+F n

Scroll one page forward (downward) in the buffer, then find next match.

It's not the most elegant solution, but it is simple, and it doesn't require you to think of the appropriate count for your n motion.

You can also go the other way with Ctrl+B N.

Since you asked for a single key, you can just make this into a mapping; whatever is most comfortable for you. Maybe something like:

noremap <C-n> <C-f>n

By default, Ctrl+n is just an alias for j.

0
3

You could use Ln to search next instance on the next page and HN to search previous instance on previous page. L - Jump to bottom of the screen H - Jump to the top of the screen

You can map these to any shortcut you want.

0

n/N support counts, You can use 5n. I recommend to read :h n.

0

Heres the out put from :h n

n                       Repeat the latest "/" or "?" [count] times.
                         If the cursor doesn't move the search is repeated with
                         count + 1.
                         last-pattern {Vi: no count}

You can just use 5n to go forward or 5N to go backwards

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.