aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--atuin/src/shell/atuin.bash8
1 files changed, 8 insertions, 0 deletions
diff --git a/atuin/src/shell/atuin.bash b/atuin/src/shell/atuin.bash
index 725b85c4..ff34aea8 100644
--- a/atuin/src/shell/atuin.bash
+++ b/atuin/src/shell/atuin.bash
@@ -3,6 +3,14 @@ ATUIN_STTY=$(stty -g)
export ATUIN_SESSION
__atuin_preexec() {
+ if [[ ! ${BLE_ATTACHED-} ]]; then
+ # With bash-preexec, preexec may be called even for the command run by
+ # keybindings. There is no general and robust way to detect the
+ # command for keybindings, but at least we want to exclude Atuin's
+ # keybindings.
+ [[ $BASH_COMMAND == '__atuin_history'* && $BASH_COMMAND != "$1" ]] && return 0
+ fi
+
local id
id=$(atuin history start -- "$1")
export ATUIN_HISTORY_ID="${id}"