Skip to content

Commit

Permalink
feat(zsh): Set terminal title to indicate atuin tui is active
Browse files Browse the repository at this point in the history
  • Loading branch information
fidgetingbits committed Jul 2, 2024
1 parent b06b7b5 commit fe0f826
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions crates/atuin/src/shell/atuin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ fi
export ATUIN_SESSION=$(atuin uuid)
ATUIN_HISTORY_ID=""

_atuin_update_title() {
if [[ "$TERM" == xterm* ]]; then
print -n "\e]0;$1\a"
fi
}

_atuin_preexec() {
local id
id=$(atuin history start -- "$1")
Expand All @@ -51,7 +57,7 @@ _atuin_precmd() {
_atuin_search() {
emulate -L zsh
zle -I

_atuin_update_title atuin
# swap stderr and stdout, so that the tui stuff works
# TODO: not this
local output
Expand All @@ -64,12 +70,12 @@ _atuin_search() {
RBUFFER=""
LBUFFER=$output

if [[ $LBUFFER == __atuin_accept__:* ]]
then
if [[ $LBUFFER == __atuin_accept__:* ]]; then
LBUFFER=${LBUFFER#__atuin_accept__:}
zle accept-line
fi
fi
_atuin_update_title zsh
}
_atuin_search_vicmd() {
_atuin_search --keymap-mode=vim-normal
Expand Down

0 comments on commit fe0f826

Please sign in to comment.