mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 11:32:42 +00:00
chore(config): update terminal, tmux, and starship configurations
This commit is contained in:
1 parent
f2802b3cd8
commit
ce9886c2e7
10 files changed
+236
-50
No files matched your search
@@ -63,7 +63,38 @@ command -v suv >/dev/null 2>&1 && eval "$(suv init zsh)"
|
||||
[ -s "$HOME/.config/envman/load.sh" ] && . "$HOME/.config/envman/load.sh"
|
||||
|
||||
# Prompt — starship, consistent with fish
|
||||
command -v starship >/dev/null 2>&1 && eval "$(starship init zsh)"
|
||||
if command -v starship >/dev/null 2>&1; then
|
||||
eval "$(starship init zsh)"
|
||||
ZLE_RPROMPT_INDENT=0 # right_format ($time) flush with the edge
|
||||
|
||||
# Transient prompt (fish has enable_transience; zsh has no starship
|
||||
# built-in): on Enter, collapse the prompt to ❯ + time, restore it next
|
||||
# precmd. Must be registered before zsh-syntax-highlighting below.
|
||||
# Profiles live in starship.toml; strip add_newline's leading \n.
|
||||
_starship_prompt=$PROMPT _starship_rprompt=$RPROMPT
|
||||
_starship_profile() {
|
||||
local s
|
||||
s=$(starship prompt --profile "$1" --status="${STARSHIP_CMD_STATUS:-}")
|
||||
print -rn -- "${s#$'\n'}"
|
||||
}
|
||||
_starship_transient() {
|
||||
PROMPT='$(_starship_profile transient)' RPROMPT='$(_starship_profile transient_right)'
|
||||
zle .reset-prompt
|
||||
}
|
||||
_starship_restore() { PROMPT=$_starship_prompt RPROMPT=$_starship_rprompt; }
|
||||
autoload -Uz add-zle-hook-widget && add-zle-hook-widget line-finish _starship_transient
|
||||
add-zsh-hook precmd _starship_restore
|
||||
fi
|
||||
|
||||
# Window title — port of fish_title.fish (+ tmux window name, as in
|
||||
# fish's conf.d/50-terminal-title.fish)
|
||||
_set_win_title() {
|
||||
local t=${(%):-%~}
|
||||
[[ -n $SSH_TTY ]] && t="${${(%):-%m}[1,10]}:$t"
|
||||
printf '\e]0;%s\a' "$t"
|
||||
[[ -n $TMUX ]] && printf '\ek%s\e\\' "$t"
|
||||
}
|
||||
autoload -Uz add-zsh-hook && add-zsh-hook precmd _set_win_title
|
||||
|
||||
# television: ctrl-t smart autocomplete (its ctrl-r is taken over by atuin
|
||||
# below, as in fish)
|
||||
|
||||
Reference in new issue
Block a user