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.

有帮助吗?

解决方案

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

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top