control-r for bash

This commit is contained in:
David Dworken 2022-10-17 20:18:28 -07:00
parent f9a01a56cb
commit 710e4dd901

View File

@ -27,3 +27,14 @@ function __hishtory_postcommand() {
}
PROMPT_COMMAND="__hishtory_postcommand; $PROMPT_COMMAND"
export HISTTIMEFORMAT=$HISTTIMEFORMAT
__history_control_r() {
READLINE_LINE=$(hishtory tquery "$READLINE_LINE" | tr -d '\n')
READLINE_POINT=0x7FFFFFFF
}
__hishtory_bind_control_r() {
bind -x '"\C-r": __history_control_r'
}
[ "$(hishtory config-get enable-control-r)" = true ] && __hishtory_bind_control_r