Question

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.

Was it helpful?

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).

OTHER TIPS

Yes, with Icicles.

In Icicle mode, command icicle-comint-search is bound to C-c ` in shell buffers. It gives you the behavior you are looking for. It is described here.

It uses only stuff that is in the currently visible history as candidates, however. If you want to access stuff from your history from previous sessions then use command comint-input-ring, bound to C-c TAB, instead. (This is explained in the same doc.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top