0

With incremental search (incsearch), we jump to matches and they are highlighted as they are found. But if we hit a character that makes the search not match anything, we’re thrown back to where we were before the search.

I’d like to turn off that behaviour, i.e. let the cursor jump to the closest match, but if at one point nothing else matches, stay where it is. It’s fine if either the whole selection stops being highlighted or if it only highlights the found section, what I care about is staying on the position of the closest match.

  • What's wrong with just using the "backspace" key when you type a character that doesn't match? That should take you back to the match you were just on, no? – filbranden Jun 26 at 15:53
  • 1
    I’m not typing one character at a time myself. I’m either pasting my search query or telling a script to type it. Backspacing one character at a time until the match is reached is boring and slow because I need to take care to not delete too much (if I do I’ll have to check what the search was supposed to be). – user137369 Jun 26 at 16:06
  • 1
    @user137369, well, that’s a different scenario from the one in the Q, which led me to the same conclusion as filbranden! Please edit and explain the problem you’re really trying to solve – D. Ben Knoble Jun 27 at 1:33

Your Answer

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

Browse other questions tagged or ask your own question.