Initial working version of control-r search

This commit is contained in:
David Dworken
2022-10-16 12:43:16 -07:00
parent 3fb55eb192
commit 5a943c20f1
4 changed files with 90 additions and 21 deletions

View File

@@ -21,3 +21,16 @@ function _hishtory_precmd() {
fi
(hishtory saveHistoryEntry zsh $_hishtory_exit_code "$_hishtory_command" $_hishtory_start_time &)
}
_hishtory_widget() {
BUFFER=$(hishtory tquery $BUFFER | tr -d '\n')
CURSOR=${#BUFFER}
zle reset-prompt
}
_hishtory_bind_control_r() {
zle -N _hishtory_widget
bindkey '^R' _hishtory_widget
}
[ "$(hishtory config-get enable-control-r)" = true ] && _hishtory_bind_control_r