Search code examples
emacscomint-mode

Emacs Comint History: Search Rather Than Navigate One By One


I would like to, after switching to the buffer where I usually run commands, navigate the history by searching it, rather than navigate one-command-at-a-time at the end of the buffer (e.g. C-p).

Basically I would like to "Reverse I-search" the command history at the end of the buffer, rather than search the buffer.

Did anyone code a working solution? Note that I noticed there is a Command History buffer available, but here it is just a bunch of text and it is not grouped well enough I think to use.


Solution

  • As in a terminal, you can use M-r to search backward. It works in comint-mode, but it also work elsewhere, like in M-x (M-xM-rpatternRET).