diff options
| author | Ellie Huxtable <e@elm.sh> | 2021-02-13 17:02:52 +0000 |
|---|---|---|
| committer | Ellie Huxtable <e@elm.sh> | 2021-02-13 17:02:52 +0000 |
| commit | 7e60ace610ea3d137fac8fd6cfb26a1f5411a609 (patch) | |
| tree | 493142aa562fa379f82e4f6b2e2a79fa7f9b085b /hook.zsh | |
| parent | Begin import (diff) | |
| download | atuin-7e60ace610ea3d137fac8fd6cfb26a1f5411a609.zip | |
Record command exit code and duration
Diffstat (limited to 'hook.zsh')
| -rw-r--r-- | hook.zsh | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -1,7 +1,17 @@ # Source this in your ~/.zshrc _atuin_preexec(){ - atuin history add $1 + id=$(atuin history start $1) + export ATUIN_HISTORY_ID="$id" +} + +_atuin_precmd(){ + local EXIT="$?" + + [[ -z "${ATUIN_HISTORY_ID}" ]] && return + + atuin history end $ATUIN_HISTORY_ID --exit $EXIT } add-zsh-hook preexec _atuin_preexec +add-zsh-hook precmd _atuin_precmd |
