Search code examples
vimincremental-search

Vim incremental search next result


I have incsearch and hlsearch enabled

So I hit / to enter search mode.

Then I type text I want to search for and it finds the first occurrence of the text I typed.

Then I want to jump to next occurrence of the text I typed without exiting search mode so that I could refine my search text later without having to exit to normal mode, then hitting n and then going back to search mode by hitting / again.

If this is possible, how can I do it?


Solution

  • The best thing that I can find that you can do is the following:

    Search for your pattern using /blah

    Then, hit n or ? until you see what's out there...

    Then go back to / and press CTRL-r /

    this will bring back the last pattern that you searched for, so you can continue entering more text there...

    I'm sure you can remap that combination to some key so that you can quickly go back to the search with the pattern already entered.