The fact that Vim highlights the strings matched by a search expression can be useful if you are searching for visual patterns in a text.

I would like to now if it was possible to quickly cycle throught the last searches? By that I mean faster that hitting / then <Up> a given number of time, because the number of time you have to hit <Up> grows quadratically with the length of the cycle.

To give an example: enter image description here There is a loop in this gif, but it would be fine if having to go back was necessary.

  • Vim doesn't have such a feature. If you can't find a plugin that does that, write it yourself.
    – romainl
    Nov 19 '16 at 7:28

When you are entering the search pattern, press CTRLP to cycle backwards through your search history or press CTRLN to cycle forwards again. This is explained at the help at :h c_CTRL-N (link)

  • That's better, thanks. However it is still necessary to press <kbd>Enter</kbd> to enable highlighting. Nov 19 '16 at 16:57
  • @GabrielDevillers if you set incsearch, you should see the highlighting immediately Nov 20 '16 at 15:37
  • on my setup, even after setting incsearch, only the first string matching the result is highlighted Nov 20 '16 at 21:31
  • @GabrielDevillers perhaps the next one does not match? Nov 21 '16 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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