* fix(bash): add a guard for interactive shells
* fix(bash): add a guard for the Bash version
* fix(bash): localize READLINE_LINE in bash < 4
In bash < 4, the variables READLINE_LINE and READLINE_POINT are not
supported for the shell commands called by `bind -x`. Even if it is
not supported, atuin works in not a bad way. However, this sometimes
causes a strange behavior by the remaining values of READLINE_LINE set
in the previous calls of __atuin_history. In bash < 4, we can
consistently use an empty string instead of $READLINE_LINE, and the
changes to READLINE_LINE and READLINE_POINT should be localized within
the function.
* fix(bash): add guard for double initialization
In bash, it is customary to reload the settings by sourcing `.bashrc`
again after modifying it. In such a case, `eval "$(atuin init bash)"`
is executed again. This registers duplicate hooks to
`preexec_functions` and `precmd_functions`. To prevent this in this
patch, we introduce an include guard, so that the initialization is
not performed more than once.
* 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.
* feat: add *Nushell* support
* refactor: use `sh` to swap `STDOUT` and `STDERR` instead of using a temporary file
* feat: include both keybindings, with the current REPL buffer passed to *Atuin*'s
* feat: don't record commands run by keybindings
* Rework `atuin init`
This allows users to disable the CTRL-R and Up Arrow bindings,
independently from one another
* Document --disable-{ctrl-r,up-arrow}
* Apply suggestions from code review
Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
Several people have asked why the bindings weren't setup after installing via their package manager
I imagine they skip straight to the install section with the name of their pkg tool, without reading the rest of the documentation.
This should hopefully make that a bit more clear! Albeit while introducing more repetition