typeset -ag prompt_functions typeset -ag rprompt_functions function prompt_builder () { result="" for prompt_func in $prompt_functions; do result="${result}$($prompt_func)%{$reset_color%} " done # prompt will always end with "% " (or "# " if we're somehow root) result="${result}%#%{$reset_color%} " print "${result}" } function rprompt_builder () { result="" for rprompt_func in $rprompt_functions; do result="$($rprompt_func)%{$reset_color%} ${result}" done result="${result}%{$reset_color%}" print "${result}" } if [[ $cols -lt 80 ]]; then if [[ $(uname -o) == "Android" ]]; then hostemoji="📞" else hostemoji="🖥" fi PROMPT="👤%{$fg_bold[white]%}@${hostemoji} %~ %# %{$reset_color%}" else PROMPT='$(prompt_builder)' RPROMPT='$(rprompt_builder)' fi TMOUT=60 TRAPALRM () { zle reset-prompt }