bashhub-client icon indicating copy to clipboard operation
bashhub-client copied to clipboard

[Suggestion] make binding for `bashhub-i-search` customizable

Open rafauke opened this issue 2 years ago • 2 comments

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 avatar Jul 26 '22 13:07 rafauke

@rafauke thanks for the suggestion! This makes sense to me. Want to submit this as a PR? Please include in bashhub.zsh as well.

rcaloras avatar Jul 26 '22 14:07 rcaloras

Sure thing :+1:

rafauke avatar Jul 27 '22 08:07 rafauke