]> arthur.barton.de Git - ax-zsh.git/blobdiff - themes/axemoji.axzshtheme
axemoji: Use nicer emoji for righthand error notice
[ax-zsh.git] / themes / axemoji.axzshtheme
index 6b6930a8918d50af45c3a524674ecae878f875d6..febacdce1ddd30ffe8b4718d83ff1ac2ba77ac3a 100644 (file)
@@ -1,15 +1,42 @@
 # AX-ZSH: Alex' Modular ZSH Configuration
-# axemoji.axzshtheme: More fancy AX-ZSH Theme
+# axemoji.axzshtheme: Fancier AX-ZSH Theme
 
 ZSH_THEME_PROMPT_PREFIX_SPACING=" "
 ZSH_THEME_PROMPT_SUFFIX_SPACING=" "
 
-ZSH_THEME_VCS_PROMPT_CLEAN="👌 "
-ZSH_THEME_VCS_PROMPT_DIRTY="👻 "
+if axzsh_is_widechar_terminal; then
+       # UTF8 capable terminal:
+       if [[ -r "$HOME/.system_emoji-$SHORT_HOST" ]]; then
+               system_emoji=$(<"$HOME/.system_emoji-$SHORT_HOST")
+       elif [[ -r "$HOME/.system_emoji" ]]; then
+               system_emoji=$(<"$HOME/.system_emoji")
+       else
+               system_emoji="🍀"
+       fi
+       [[ -n "$VTE_VERSION" ]] \
+               && emoji_spacing="" \
+               || emoji_spacing=" "
 
-PS1="🍀  $(ax_logname_prompt_yn)$(ax_hostname_prompt_yn)%B%2~%b"'$(ax_vcs_prompt)'"$(ax_prompt)"
+       ZSH_THEME_VCS_PROMPT_CLEAN="👌$emoji_spacing"
+       ZSH_THEME_VCS_PROMPT_DIRTY="👻$emoji_spacing"
 
-# Prompt on right side
-axzsh_is_utf_terminal \
-       && RPS1="%(?..%{$fg_no_bold[red]%}❌ %? ↵%{$reset_color%})" \
-       || RPS1="%(?..%{$fg_no_bold[red]%}<%?>%{$reset_color%})"
+       # Primary prompt on the right-hand side.
+       RPS1="%(?..%{$fg_no_bold[red]%}🤔$emoji_spacing %?↵%{$reset_color%})"
+else
+       # Non-UTF8 or incompatible terminal
+       system_emoji=">"
+       emoji_spacing=""
+
+       # Primary prompt on the right-hand side.
+       RPS1="%(?..%{$fg_no_bold[red]%}<%?>%{$reset_color%})"
+fi
+
+# The primary prompt string, printed before a command is read.
+PS1="${system_emoji}${emoji_spacing} $(ax_logname_prompt_yn)$(ax_hostname_prompt_yn)%B%2~%b"'$(ax_vcs_prompt)'"$(ax_prompt)"
+
+# Default execution trace prompt.
+PS4="$fg_no_bold[yellow]->$reset_color "
+# This prompt is compatible with sh(1) and bash(1), too, so export it!
+export PS4
+
+unset system_emoji emoji_spacing