# gentoo prompt theme prompt_gentoo_help () { cat <<'EOF' This prompt is color-scheme-able. You can invoke it thus: prompt gentoo [ [ []]] EOF } prompt_gentoo_setup () { prompt_gentoo_prompt=${1:-'blue'} prompt_gentoo_user=${2:-'green'} prompt_gentoo_root=${3:-'red'} if [ "$USER" = 'root' ] then base_prompt="%{$fg_bold[$prompt_gentoo_root]%}%m%{$reset_color%} " else base_prompt="%{$fg_bold[$prompt_gentoo_user]%}%n@%m%{$reset_color%} " fi post_prompt="%{$reset_color%}" local color="%{*}" base_prompt_no_color="${(S)base_prompt//${~color}/}" post_prompt_no_color="${(S)post_prompt//${~color}/}" setopt noxtrace localoptions local base_prompt_expanded_no_color base_prompt_etc local prompt_length space_left base_prompt_expanded_no_color=$(print -P "$base_prompt_no_color") base_prompt_etc=$(print -P "$base_prompt%(4~|...|)%3~") prompt_length=${#base_prompt_etc} path_prompt="%{$fg_bold[$prompt_gentoo_prompt]%}%1~" PS1="$base_prompt$path_prompt %# $post_prompt" PS2="$base_prompt$path_prompt %_> $post_prompt" PS3="$base_prompt$path_prompt ?# $post_prompt" precmd () { } preexec () { } } prompt_gentoo_setup "$@"