Emacs: isearch by Arrow Keys

By Xah Lee. Date: . Last updated: .

Here's very convenient keys for isearch. Put it in your emacs init.

(progn
  ;; set arrow keys in isearch. left/right is backward/forward, up/down is history. press Return to exit
  (define-key isearch-mode-map (kbd "<up>") 'isearch-ring-retreat )
  (define-key isearch-mode-map (kbd "<down>") 'isearch-ring-advance )

  (define-key isearch-mode-map (kbd "<left>") 'isearch-repeat-backward)
  (define-key isearch-mode-map (kbd "<right>") 'isearch-repeat-forward)

  (define-key minibuffer-local-isearch-map (kbd "<left>") 'isearch-reverse-exit-minibuffer)
  (define-key minibuffer-local-isearch-map (kbd "<right>") 'isearch-forward-exit-minibuffer))

when in isearch, the arrow keys will:

This way, searching forward/backward is just one single key press, no key combination.

This is especially useful with a command that searches current word. See: Emacs: isearch Current Word.

For basics of isearch, see: Emacs: Search Text in Buffer.

Emacs Keybinding Tips

  1. Add Custom Keys to Enhance Productivity
  2. isearch by Arrow Keys
  3. Bind Number Pad Keys
  4. 1 Key for M-x
  5. Hotkey to Open File Fast
  6. Add Web Browser Back Key/Button to Info mode
  7. Ctrl+x and Dvorak

If you have a question, put $5 at patreon and message me.
Or Buy Xah Emacs Tutorial
Or buy a nice keyboard: Best Keyboards for Emacs

Emacs

Emacs Lisp

Misc