Closed jpninanjohn closed 4 years ago
Thank you for your feedback.
Currently installing ble overrides my key binding for the C-r.
I tried fzf
but the situation is different in my environment. In short, ble.sh
does not override the key binding C-r, and in fact fzf
is called. But the resulting selection by fzf
will not be expanded as expected. It should involve two different matters.
ble.sh
I would like to ask about details of your installation of ble.sh
(because you mentioned that "ble overrides the key binding for C-r")? If ble.sh
is correctly set up in your bashrc
, ble.sh
should not override the key binding. If you haven't checked the corresponding section of README, could you first check that section? Actually the command source ble.sh
should be placed before any key binding settings. Specifically source ble.sh
should be placed before the load of fzf
. That is the reason why source ble.sh
should be put at the top of bashrc
.
shell-expand-line
As for the problem that the resulting selection by fzf
is not expanded, I looked into the settings of fzf
and found that it uses the readline function shell-expand-line
. ble.sh
supports shell-expand-line
only from ble-0.4
(master branch which is available with git
and make
commands). Even if one uses ble-0.4
, it slightly modifies the behavior of shell-expand-line
in a safer way, which causes the failure of the expansion requested by fzf
. I don't have a plan to revert the behavior to the previous one. So we need to write a special setting for the combination of fzf
and ble.sh
. The following setting should work. Please put it in bashrc
(between source ble.sh
and ble-attach
):
ble-bind -x C-r __fzf_history_for_blesh__
__fzf_history_for_blesh__() {
READLINE_LINE=$(history -p "$(__fzf_history__)")
READLINE_POINT=${#READLINE_LINE}
}
Would be nice to have a way to unbind from ble through a command.
The way to unbind a key binding is described here. To unbind C-r, you can write the following command after the source of ble.sh
:
ble-bind -x C-r -
Equivalently, you may instead use the readline style setting after the source of ble.sh
:
bind -r '\C-r'
But, actually I don't think this resolves the issue of fzf
because C-r loses any effects if you unbind C-r. Maybe it should be clarified here that ble.sh
is not a usual configuration that provides additional features to readline
(the default line editor of Bash), but it is actually a line editor independent of readline
and completely replaces readline
. Every readline settings including key bindings are emulated on top of ble.sh
.
I am not sure if the key binding is configurable through a file. If it is could you point me to which file I should make the change in.
Key binding settings can be specified in your ~/.blerc
. The simplest description can be found in the related section of README. Detailed descriptions can be found in the page Key Binding of the manual. Other pages of the manual are also useful to find available widgets,
Thanks for the detailed response. Will try this out
I use fzf for going through my history. Currently installing ble overrides my key binding for the C-r. Would be nice to have a way to unbind from ble through a command.
I am not sure if the key binding is configurable through a file. If it is could you point me to which file I should make the change in.