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 Current File.

Emacs Find Replace

If you have a question, put $5 at patreon and message me on xah discord.
Or support me by Buy Xah Emacs Tutorial

Emacs Tutorial

Emacs Init

Emacs Keys

ELisp

ELisp Examples

ELisp Write Major Mode


Emacs Keys

Overview

How-To

Key Tips

Emacs Pinky

Keybinding Design

Misc