# e101 prompt # Adapted from elite2 prompt which was: # Created by icetrey # Added by Spidey 08/06 # Converted to zsh prompt theme by # $Id: zsh_prompts,v 1.4 2003/06/18 14:45:52 dave Exp $ prompt_e101_help () { cat < []] The default colors are both blue. It shows: user@host - tty - date - uname/dist history_num - 3 dirs of path - And has been tested on FreeBSD, Linux and OS X (for which it shows the version of OS X as well as Darwin) EOH } prompt_e101_setup () { local text_col=${1:-'blue'} local parens_col=${2:-'blue'} for code in 332 304 304 371 371 371 372 300 304 304 371 372; do local varname=char_$code : ${(P)varname=$(echo -n "\\0$code")} done local tty=`tty|cut -d/ -f3` local text="%{$fg_no_bold[$text_col]%}" local parens="%{$fg_bold[$parens_col]%}" local punctuation_color="%{$fg_bold[grey]%}" local reset="%{$reset_color%}" local os_string local OS=`uname` local OS_VERS if [[ "$OS" == "Darwin" ]]; then os_string="OS X `sw_vers | sed -n '/\([0-9]\.\)/s/.*: //p'`" OS_VERS="Darwin `uname -r`" else os_string=$OS OS_VERS=`uname -r` fi PS1="$punctuation_color$text$parens - $text%n$punctuation_color@$text%m$parens - $text%D{%a %d %b %Y %R}$parens -$text $os_string/$OS_VERS $parens-$reset$prompt_newline$punctuation_color$text$parens - $text%!$parens - $text%3~$text$punctuation_color -$reset " PS2="$parens$text$punctuation_color-$reset " precmd () { setopt promptsubst } preexec () { } } prompt_e101_preview () { local color colors colors=(red yellow green blue magenta) if (( ! $#* )); then for (( i = 1; i <= $#colors; i++ )); do color=$colors[$i] prompt_preview_theme e101 $color (( i < $#colors )) && print done else prompt_preview_theme e101 "$@" fi } prompt_e101_short_setup () { local text_col=${1:-'blue'} local punctuation_col=${2:-'blue'} local userhost_col=${3:-'cyan'} local tty=`tty|cut -d/ -f3` text="%{$fg_no_bold[$text_col]%}" punctuation="%{$fg_bold[$punctuation_col]%}" userhost="%{$fg_no_bold[$userhost_col]%}" reset="%{$reset_color%}" PS1="$punctuation- $userhost%n$punctuation@$userhost%m$punctuation - $text%B%3~%b$prompt_newline$punctuation- $reset" PS2="$punctuation-$reset " precmd () { setopt promptsubst } preexec () { } } prompt_themes=($prompt_themes e101 e101_short)