bashhub-client
bashhub-client copied to clipboard
[Suggestion] make binding for `bashhub-i-search` customizable
Suggestion:
It would be great to have a customizable binding for bashhub-i-search
.
Motivation:
The current binding collides with the default backward-char
binding.
Ideas: This could be controlled with an env variable, I think this could be the easiest implementation and it's backwards-compatible.
Naive example:
# in .bashrc
# rebind bashub to C-x C-b
export BH_BIND_PREFIX="\"\C-x\C-b\""
# in bashhub.sh
__bh_hook_bashhub() {
if [ -t 1 ]; then
# Alias to bind Ctrl + B
if [ -z "${BH_BIND_PREFIX+x}" ]; then
bind '"\C-b":"\C-ubh -i\n"'
else
bind "$BH_BIND_PREFIX"':"\C-ubh -i\n"'
fi
fi
# ...
The amount of quotes can be reduced most probably, but I think the example is good enough. What do you think? :)
@rafauke thanks for the suggestion! This makes sense to me. Want to submit this as a PR? Please include in bashhub.zsh as well.
Sure thing :+1: