blob: 43de3640e132383f962d7eb320a1b75462bbff0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
_atuin_preexec() {
id=$(atuin history start "$1")
export ATUIN_HISTORY_ID="$id"
}
_atuin_precmd() {
local EXIT="$?"
[[ -z "${ATUIN_HISTORY_ID}" ]] && return
(RUST_LOG=error atuin history end $ATUIN_HISTORY_ID --exit $EXIT &) > /dev/null 2>&1
}
__atuin_history ()
{
tput rmkx
HISTORY="$(RUST_LOG=error atuin search -i $BUFFER 3>&1 1>&2 2>&3)"
tput smkx
READLINE_LINE=${HISTORY}
READLINE_POINT=${#READLINE_LINE}
}
preexec_functions+=(_atuin_preexec)
precmd_functions+=(_atuin_precmd)
bind -x '"\C-r": __atuin_history'
|