Skip to content

[Suggestion] make binding for bashhub-i-search customizable #113

@rafauke

Description

@rafauke

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? :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions