Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rafauke opened this issue Jul 26, 2022 · 2 comments
Open

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

rafauke opened this issue Jul 26, 2022 · 2 comments

Comments

@rafauke
Copy link

rafauke commented Jul 26, 2022

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

@rcaloras
Copy link
Owner

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

@rafauke
Copy link
Author

rafauke commented Jul 27, 2022

Sure thing 👍

@rafauke rafauke changed the title [Suggestion] make binding for bashub-i-search customizable [Suggestion] make binding for bashhub-i-search customizable Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants