Endless Parentheses

Ramblings on productivity and technical subjects.

profile for Malabarba on Stack Exchange

Better backspace during isearch

I’ve never been too pleased with the default behaviour of Backspace during isearch. If the last key you hit was C-s, then it does the same as C-r (albeit with less repetition), and if your match failed several characters ago, you need to hit it that many times to get back on track. Fortunately, asmeurer took the time to phrase this problem I barely realised I had.

In response, Drew provides a command to:

  1. delete the entire portion of isearch string that doesn’t match,
  2. if everything matches, fallback on deleting last char instead of moving backwards.

Finally, John Mastro has yet another improvement for the command, which is the one I’m using now. I’ll let you follow the link for the code, and just give you the keybind you need for it to work.

(define-key isearch-mode-map (kbd "<backspace>") 
  #'isearch-delete-something)

Tags: init.el, emacs,

comments powered by Disqus