This package provides a command completing-history-insert-item to
insert an item from history using completion. It calls completing-read
to do this, meaning it will work with your preferred completion
framework. The package supports: the minibuffer, eshell, comint and
term.
There is also a function completing-history-setup-keybinding to setup
a keybinding for you in all supported contexts. By default it binds
completing-history-insert-item to M-r (usually bound to a command that
gets the previous history item matching a regexp) and unbinds the
companion M-s command (usually bound to a command that searches
forward in the history).
To customize the binding of completing-history-insert-item, use
completing-history-binding. To keep M-s from being unbound customize
completing-history-unbind-M-s.
Sorry, there are no plans to put this on MELPA.
If you prefer packages on MELPA, you can use the consult-history
command from Consult instead of the completing-history-insert-item
command from this package. By design, Consult does not setup any key
bindings for you. You can get the effect of (completing-history-setup-keybinding) by binding consult-history to M-r and unbinding M-s in each of the following keymaps:
minibuffer-local-mapeshell-hist-mode-mapif you are on Emacs >=27, andesh-mode-mapfor Emacs <27. Note that if you are on Emacs <27 and want to bind something inesh-mode-mapyou need to do it in theeshell-mode-hook!shell-mode-mapterm-mode-mapterm-raw-mapcomint-mode-mapslime-repl-mode-map