zsh: Add transient prompt

As an experimental change (and following my adding a transient prompt
for nushell which I like), this change adds a transient prompt plugin
for zsh. It then defines the 'tansient prompt' prompt to use starship so
functionally nothing should change about the prompt (or the rprompt),
except for being transient, showing only a character for previous prompts.

From: https://github.com/starship/starship/issues/888#issuecomment-3597694479
This commit is contained in:
Marty Oehme 2025-12-10 09:32:14 +01:00
parent b6e84bbc99
commit 8b2f9b6815
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -29,6 +29,7 @@ if command -v zr >/dev/null 2>&1; then
zdharma-continuum/fast-syntax-highlighting \
zsh-users/zsh-autosuggestions \
zsh-users/zsh-completions \
olets/zsh-transient-prompt \
)
else # or manually
@ -43,6 +44,7 @@ else # or manually
[ -e $PLUG_FOLDER/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ] && source $PLUG_FOLDER/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
[ -e $PLUG_FOLDER/alias-tips/alias-tips.plugin.zsh ] && source $PLUG_FOLDER/alias-tips/alias-tips.plugin.zsh
[ -e $PLUG_FOLDER/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh ] && source $PLUG_FOLDER/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
[ -e $PLUG_FOLDER/zsh-transient-prompt/transient-prompt.plugin.zsh ] && source $PLUG_FOLDER/zsh-transient-prompt/transient-prompt.plugin.zsh
fi
unset PLUG_FOLDER
@ -133,6 +135,9 @@ ENABLE_CORRECTION="true"
setopt autocd
eval "$(starship init zsh)"
TRANSIENT_PROMPT_PROMPT='$(starship prompt --terminal-width="$COLUMNS" --keymap="${KEYMAP:-}" --status="$STARSHIP_CMD_STATUS" --pipestatus="${STARSHIP_PIPE_STATUS[*]}" --cmd-duration="${STARSHIP_DURATION:-}" --jobs="$STARSHIP_JOBS_COUNT")'
TRANSIENT_PROMPT_RPROMPT='$(starship prompt --right --terminal-width="$COLUMNS" --keymap="${KEYMAP:-}" --status="$STARSHIP_CMD_STATUS" --pipestatus="${STARSHIP_PIPE_STATUS[*]}" --cmd-duration="${STARSHIP_DURATION:-}" --jobs="$STARSHIP_JOBS_COUNT")'
TRANSIENT_PROMPT_TRANSIENT_PROMPT='$(starship module character)'
eval "$(zoxide init zsh)"
eval "$(atuin init zsh)"
export CARAPACE_BRIDGES='zsh,fish,bash,inshellisense' # optional