2020-10-04 18:00:55 -06:00
|
|
|
# Source this in your ~/.zshrc
|
|
|
|
|
2021-02-13 05:58:40 -07:00
|
|
|
_atuin_preexec(){
|
2021-02-13 10:02:52 -07:00
|
|
|
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
|
2020-10-04 18:00:55 -06:00
|
|
|
}
|
|
|
|
|
2021-02-13 05:58:40 -07:00
|
|
|
add-zsh-hook preexec _atuin_preexec
|
2021-02-13 10:02:52 -07:00
|
|
|
add-zsh-hook precmd _atuin_precmd
|