about summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2004-11-24 05:05:50 +0000
committerClint Adams <clint@users.sourceforge.net>2004-11-24 05:05:50 +0000
commitdaade2bfaea50ccdac5897f6003ddbd8ffb6dd61 (patch)
treeade792f7cb5e47972187a8b2fdbc734d39e046bb /Functions
parent138c5df2bb1b16f712374ec1bd8024a143856793 (diff)
downloadzsh-daade2bfaea50ccdac5897f6003ddbd8ffb6dd61.tar.gz
zsh-daade2bfaea50ccdac5897f6003ddbd8ffb6dd61.tar.xz
zsh-daade2bfaea50ccdac5897f6003ddbd8ffb6dd61.zip
20578: Functions/Prompts/prompt_elite2_setup: handle ttys with slashes in them.
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Prompts/prompt_elite2_setup59
1 files changed, 49 insertions, 10 deletions
diff --git a/Functions/Prompts/prompt_elite2_setup b/Functions/Prompts/prompt_elite2_setup
index c6bb0b076..7e7748ec7 100644
--- a/Functions/Prompts/prompt_elite2_setup
+++ b/Functions/Prompts/prompt_elite2_setup
@@ -1,17 +1,56 @@
-# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
 # Created by icetrey <trey@imagin.net>
 # Added by Spidey 08/06
+# Converted to zsh prompt theme by <adam@spiers.net>
+
+prompt_elite2_help () {
+  cat <<EOH
+This prompt is color-scheme-able.  You can invoke it thus:
+
+  prompt elite2 [<text-color> [<parentheses-color>]]
+
+The default colors are both cyan.  This theme works best with a dark
+background.
+
+Recommended fonts for this theme: nexus or vga or similar.  If you
+don't have any of these, the 8-bit characters will probably look stupid.
+EOH
+}
+
 prompt_elite2_setup () {
-  local GRAD1=`tty|cut -d/ -f3`
-  local COLOR1="%{$reset_color$fg_cyan%}"
-  local COLOR2="%{$bold_color$fg_cyan%}"
-  local COLOR3="%{$bold_color$fg_grey%}"
-  local COLOR4="%{$reset_color%}"
-  PS1="$COLOR3レ$COLOR1ト$COLOR2($COLOR1%n$COLOR3@$COLOR1%m$COLOR2)$COLOR1ト$COLOR2($COLOR1%!$COLOR3/$COLOR1$GRAD1$COLOR2)$COLOR1ト$COLOR2($COLOR1%D{%I:%M%P}$COLOR3:$COLOR1%D{%m/%d/%y}$COLOR2)$COLOR1ト$COLOR3-$COLOR4$prompt_newline$COLOR3タ$COLOR1ト$COLOR2($COLOR1%#$COLOR3:$COLOR1%~$COLOR2)$COLOR1ト$COLOR3-$COLOR4 " 
-  PS2="$COLOR2ト$COLOR1ト$COLOR3-$COLOR4 "
-
-  precmd () { }
+  local text_col=${1:-'cyan'}
+  local parens_col=${2:-$text_col}
+
+  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 text="%{$fg_no_bold[$text_col]%}"
+  local parens="%{$fg_bold[$parens_col]%}"
+  local punctuation_color="%{$fg_bold[grey]%}"
+  local reset="%{$reset_color%}"
+
+  PS1="$punctuation_colorレ$textト$parens($text%n$punctuation_color@$text%m$parens)$textト$parens($text%!$punctuation_color/$text%y$parens)$textト$parens($text%D{%I:%M%P}$punctuation_color:$text%D{%m/%d/%y}$parens)$textト$punctuation_color-$reset$prompt_newline$punctuation_colorタ$textト$parens($text%#$punctuation_color:$text%~$parens)$textト$punctuation_color-$reset " 
+
+  PS2="$parensト$textト$punctuation_color-$reset "
+
+  precmd () { setopt promptsubst }
   preexec () { }
 }
 
+prompt_elite2_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 elite2 $color
+      (( i < $#colors )) && print
+    done
+  else
+    prompt_preview_theme elite2 "$@"
+  fi
+}
+
 prompt_elite2_setup "$@"