diff options
| author | Koichi Murase <myoga.murase@gmail.com> | 2024-01-08 07:19:46 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-07 22:19:46 +0000 |
| commit | 7dca752dc31f84c3fad8475b0734c777670708e3 (patch) | |
| tree | 230834a3746b41c675ca944925e5d6c275b76624 /atuin-server-postgres/src | |
| parent | fix(bash): work around custom IFS (#1514) (diff) | |
| download | atuin-7dca752dc31f84c3fad8475b0734c777670708e3.zip | |
fix(bash): fix and improve the keybinding to `up` (#1515)
* fix(bash): improve up key in multiline mode of ble.sh
ble.sh has a multiline mode where pressing [up] can be used to move to
the previous line. The command history is loaded only when the [up]
key is pressed when the cursor is in the first line. However, with
Atuin's integration, the [up] key always causes Atuin's history search
and cannot be used to move to the previous line when the cursor is not
in the first line. There is also another situation that the [up] key
does not load the command history.
In this patch, with ble.sh, we perform Atuin's history search only in
the situation where the command history is loaded in the original
binding of ble.sh.
* fix(init): perform bind on explicitly specified keymaps
With the current implementation, the keybindings to [C-r] and [up] are
only set up in the currently activated keymaps in Bash. As a result,
if the user changes the keymap after `eval "$(atuin init bash)"`,
Atuin's keybindings do not take effect. In this patch, we bind
Atuin's keybindings in all the keymaps (emacs, vi-insert, and
vi-command) by explicitly specifying them (as done for the Zsh
integration). The keybinding to "k" in the vi-command keymap is also
added to make it consistent with the Zsh integration.
* fix(init): work around limitation of "bind -x" in bash <= 4.2
In bash <= 4.2, "bind -x" with a key sequence with more than two bytes
does not work properly. Inputting the key sequence will produce an
error message saying "bash: bash_execute_unix_command: cannot find
keymap for command", and the shell command is not executed.
To work around this, we can first translate the key sequences to
another key sequence with two bytes and run the shell command through
the two-byte key sequence. In this patch, we use \C-x\C-p as the
two-byte key sequence.
* refactor(bash): move the inlined binding scripts to atuin.bash
* refactor(init): use `is_ok()` instead of negating `is_err()`
Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
---------
Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
Diffstat (limited to 'atuin-server-postgres/src')
0 files changed, 0 insertions, 0 deletions
