There are 2 existing ways to get something like this easily:
- zsh's history-substring-search plugin
- bash's
ctrl+r
mode
The problem with zsh is that it's not on many systems. The problem with bash's implementations is that it requires me to hit ctrl+r first. Also, I know about history-search-backward
in bash, but it is anchored to the beginning of the command and not nearly as powerful.
I'm hoping there is a way to bind the up key in bash to make it:
- copy the currently typed command buffer
- enter
ctrl+r
mode - paste the currently type command buffer in that mode
and on subsequent presses of the up key
- hit
ctrl+r
(search next previous)