I am trying to implement a custom version of zsh history search when pressing ctrl-r (although my function will map to different shortcut).
So far I have tried to use read , vared and read-command to read input after user presses the bespoke shortcut. My code looks like:
# Bind \eg to `git status`
function _cust-hist {
zle -I
local line
read -r line
echo $line
zle accept-line
}
zle -N _cust-hist
bindkey '\eg' _cust-hist
But nothing seems to work. I must be missing something obvious, is this possible with zsh?