diff options
author | Koichi Murase <myoga.murase@gmail.com> | 2023-12-29 05:08:45 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-28 20:08:45 +0000 |
commit | a4122f062acdf7ccaf8b81acf35056b7c6f28c5e (patch) | |
tree | ce5360117cb7d347826eadcfd768d60004d1af46 /README.md | |
parent | 5401ff12b720d58fbf0b22e197c546e7730e18b6 (diff) |
fix(bash): improve the support for `enter_accept` with `ble.sh` (#1465)
* feat(bash): check version of ble.sh
blehooks are only supported in ble.sh >= 0.4, so we require the ble.sh
version to be larger or equal to 0.4. We also describe the version
requirement in README.md.
* fix(bash): use ble.sh's contrib/integration/bash-preexec
ble.sh provides module "contrib/integration/bash-preexec", which can
be used with the same interface as bash-preexec. This module provides
"preexec_functions" and "precmd_functions" without requiring
bash-preexec.
This module also properly handles it when both ble.sh and bash-preexec
are loaded; the module resolves the conflicts between ble.sh and
bash-preexec, and the module also tries to support bash-preexec in the
detached state of ble.sh.
* fix(bash): use ble.sh's accept-line widget for enter_accept
In ble.sh, one can directly call the widget "accept-line" from a shell
script. The widget "accept-line" is the actual widget that reserves
the command execution in ble.sh, so calling "accept-line" is
equivalent to the normal execution. It includes all the necessary
adjustments and processing including stty and history.
In addition, the command will be executed at the top-level context
instead in a function scope. For example, without ble.sh, running
"declare -A dict=()" through enter_accept will create an associative
array in the function scope unexpectedly. With ble.sh, since the
command is executed at the top-level context, such a problem does not
happen.
When ble.sh is in a detached state, we fall back to the manual
execution of the command. In this case, we cannot assume the
existence of the shell function "__bp_set_ret_value", so we always use
__atuin_set_ret_value.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -274,14 +274,16 @@ antigen bundle atuinsh/atuin@main #### [ble.sh](https://github.com/akinomyoga/ble.sh) -Atuin works best in bash when using [ble.sh](https://github.com/akinomyoga/ble.sh). +Atuin works best in bash when using [ble.sh](https://github.com/akinomyoga/ble.sh) >= 0.4. -With ble.sh installed, just add atuin to your .bashrc +With ble.sh (>= 0.4) installed, just add atuin to your .bashrc ```bash echo 'eval "$(atuin init bash)"' >> ~/.bashrc ``` +Please make sure that the above line comes after sourcing ble.sh so atuin knows the presence of ble.sh. + #### [bash-preexec](https://github.com/rcaloras/bash-preexec) [Bash-preexec](https://github.com/rcaloras/bash-preexec) can also be used, but you may experience some minor problems with the recorded duration and exit status of some commands. |