Enhancements to bash init script (#445)
This commit is contained in:
parent
fab8d8590f
commit
e0ba60fc3c
1 changed files with 7 additions and 7 deletions
|
@ -2,8 +2,8 @@ ATUIN_SESSION=$(atuin uuid)
|
||||||
export ATUIN_SESSION
|
export ATUIN_SESSION
|
||||||
|
|
||||||
_atuin_preexec() {
|
_atuin_preexec() {
|
||||||
local id; id=$(atuin history start "$1")
|
local id; id=$(atuin history start "$1")
|
||||||
export ATUIN_HISTORY_ID="$id"
|
export ATUIN_HISTORY_ID="${id}"
|
||||||
}
|
}
|
||||||
|
|
||||||
_atuin_precmd() {
|
_atuin_precmd() {
|
||||||
|
@ -11,21 +11,19 @@ _atuin_precmd() {
|
||||||
|
|
||||||
[[ -z "${ATUIN_HISTORY_ID}" ]] && return
|
[[ -z "${ATUIN_HISTORY_ID}" ]] && return
|
||||||
|
|
||||||
(RUST_LOG=error atuin history end "$ATUIN_HISTORY_ID" --exit $EXIT &) > /dev/null 2>&1
|
(RUST_LOG=error atuin history end "${ATUIN_HISTORY_ID}" --exit "${EXIT}" &) > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
__atuin_history ()
|
__atuin_history ()
|
||||||
{
|
{
|
||||||
tput rmkx
|
tput rmkx
|
||||||
HISTORY="$(RUST_LOG=error atuin search -i "$BUFFER" 3>&1 1>&2 2>&3)"
|
HISTORY="$(RUST_LOG=error atuin search -i "${READLINE_LINE}" 3>&1 1>&2 2>&3)"
|
||||||
tput smkx
|
tput smkx
|
||||||
|
|
||||||
READLINE_LINE=${HISTORY}
|
READLINE_LINE=${HISTORY}
|
||||||
READLINE_POINT=${#READLINE_LINE}
|
READLINE_POINT=${#READLINE_LINE}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [[ -n "${BLE_VERSION-}" ]]; then
|
if [[ -n "${BLE_VERSION-}" ]]; then
|
||||||
blehook PRECMD-+=_atuin_precmd
|
blehook PRECMD-+=_atuin_precmd
|
||||||
blehook PREEXEC-+=_atuin_preexec
|
blehook PREEXEC-+=_atuin_preexec
|
||||||
|
@ -34,6 +32,8 @@ else
|
||||||
preexec_functions+=(_atuin_preexec)
|
preexec_functions+=(_atuin_preexec)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z $ATUIN_NOBIND ]]; then
|
if [[ -z ${ATUIN_NOBIND} ]]; then
|
||||||
bind -x '"\C-r": __atuin_history'
|
bind -x '"\C-r": __atuin_history'
|
||||||
|
bind -x '"\e[A": __atuin_history'
|
||||||
|
bind -x '"\eOA": __atuin_history'
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue