about summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-18 15:15:27 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-18 15:15:27 +0000
commit273644abe162d1a7a3e98c392403162a00224628 (patch)
tree9496b458ce0f4553ba723255cf8a17703ed97ed3 /Functions
parent6f50f016747f878b480c3ee109e4fcf6c87a2fff (diff)
downloadzsh-273644abe162d1a7a3e98c392403162a00224628.tar.gz
zsh-273644abe162d1a7a3e98c392403162a00224628.tar.xz
zsh-273644abe162d1a7a3e98c392403162a00224628.zip
Initial revision
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Prompts/prompt_bigfade_setup50
-rw-r--r--Functions/Prompts/prompt_fade_setup58
-rw-r--r--Functions/Prompts/prompt_zefram_setup17
3 files changed, 125 insertions, 0 deletions
diff --git a/Functions/Prompts/prompt_bigfade_setup b/Functions/Prompts/prompt_bigfade_setup
new file mode 100644
index 000000000..260c0ddf0
--- /dev/null
+++ b/Functions/Prompts/prompt_bigfade_setup
@@ -0,0 +1,50 @@
+# Generic large colour fade-bar prompt theme from bashprompt
+# Created by James Manning <jmm@raleigh.ibm.com>
+# Changed by Spidey 08/06
+# Converted to zsh prompt theme by <adam@spiers.net>
+
+prompt_bigfade_help () {
+  cat <<EOH
+This prompt is color-scheme-able.  You can invoke it thus:
+
+  prompt bigfade [<fade-bar> [<userhost> [<date> [<cwd>]]]]
+
+where the parameters are the colors for the fade-bar, user@host text,
+date text, and current working directory respectively.  The default
+colors are blue, white, white, and yellow.  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_bigfade_setup () {
+  local fadebar=${1:-'blue'}
+  local userhost=${2:-'white'}
+  local date=${3:-'white'}
+  local cwd=${4:-'yellow'}
+
+  for code in 333 262 261 260 260 261 262 333 333 262 261 260 333 262 261 260 260 261 262 333 333 262 261 260; do
+    local varname=char_$code
+    : ${(P)varname=$(echo -n "\\0$code")}
+  done
+
+  PS1="%{$bold_color$fg[$fadebar]$bold_color%}$char_333$char_262$char_261$char_260%{$bold_color$fg[$userhost]$bg[$fadebar]%}%n@%m%{$reset_color$fg[$fadebar]$bg[grey]%}$char_260$char_261$char_262$char_333%{$reset_color$fg[$fadebar]$bg[grey]%}$char_333$char_262$char_261$char_260%{$bold_color$fg[$date]$bg[grey]%} %D{%a %b %d} %D{%I:%M:%S%P}$prompt_newline%{$bold_color$fg[$cwd]$bg[grey]%}$PWD>%{$reset_color%} "
+  PS2="%{$bold_color$fg[$fadebar]$bold_color%}$char_333$char_262$char_261$char_260%{$reset_color$fg[$fadebar]$bg[grey]%}$char_260$char_261$char_262$char_333%{$reset_color$fg[$fadebar]$bg[grey]%}$char_333$char_262$char_261$char_260%{$bold_color$bold_color$fg[$fadebar]%}>%{$reset_color%} "
+
+  precmd () { setopt promptsubst }
+  preexec () { }
+}
+
+prompt_bigfade_preview () {
+  if (( ! $#* )); then
+    prompt_preview_theme bigfade
+    print
+    prompt_preview_theme bigfade red white grey white
+  else
+    prompt_preview_theme bigfade "$@"
+  fi
+}
+
+prompt_bigfade_setup "$@"
diff --git a/Functions/Prompts/prompt_fade_setup b/Functions/Prompts/prompt_fade_setup
new file mode 100644
index 000000000..5b49f6105
--- /dev/null
+++ b/Functions/Prompts/prompt_fade_setup
@@ -0,0 +1,58 @@
+# Generic colour fade-bar prompt theme from bashprompt
+# Created by Jim Foltz <aa204@acorn.net>
+# Changed by Spidey 08/06
+# Converted to zsh prompt theme by <adam@spiers.net>
+
+prompt_fade_help () {
+  cat <<EOH
+This prompt is color-scheme-able.  You can invoke it thus:
+
+  prompt fade [<fade-bar-and-cwd> [<userhost> [<date>]]] 
+
+where the parameters are the colors for the fade-bar and current
+working directory, user@host text, and date text respectively.  The
+default colors are green, white, and white.  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
+}
+
+# emacs shell-script mode gets confused with ' in heredoc above
+
+prompt_fade_setup () {
+  local fadebar_cwd=${1:-'green'}
+  local userhost=${2:-'white'}
+  local date=${3:-'white'}
+
+  for code in 333 262 261 260 333 262 261 260 333 262 261 260; do
+    local varname=char_$code
+    : ${(P)varname=$(echo -n "\\0$code")}
+  done
+
+  PS1="%{$fg[$fadebar_cwd]$bg[$fadebar_cwd]$bold_color%}$char_333$char_262$char_261$char_260%{$fg[$userhost]$bg[$fadebar_cwd]$bold_color%}%n@%m%{$reset_color$fg[$fadebar_cwd]$bg[grey]%}$char_333$char_262$char_261$char_260%{$fg[$date]$bg[grey]$bold_color%} %D{%a %b %d} %D{%I:%M:%S%P} $prompt_newline%{$fg[$fadebar_cwd]$bg[grey]$bold_color%}%~/%{$reset_color%} "
+  PS2="%{$fg[$fadebar_cwd]$bg[grey]%}$char_333$char_262$char_261$char_260%{$reset_color%}>"
+
+  precmd () { setopt promptsubst }
+  preexec () { }
+}
+
+prompt_fade_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 fade $color
+      print
+    done
+    prompt_preview_theme fade white grey blue
+  else
+    prompt_preview_theme fade "$@"
+  fi
+}
+
+prompt_fade_setup "$@"
diff --git a/Functions/Prompts/prompt_zefram_setup b/Functions/Prompts/prompt_zefram_setup
new file mode 100644
index 000000000..3e6d34840
--- /dev/null
+++ b/Functions/Prompts/prompt_zefram_setup
@@ -0,0 +1,17 @@
+function prompt_zefram_precmd {
+	local exitstatus=$?
+	psvar=(SIG)
+	[[ $exitstatus -gt 128 ]] && psvar[1]=SIG$signals[$exitstatus-127]
+	[[ $psvar[1] = SIG ]] && psvar[1]=$exitstatus
+	jobs % >/dev/null 2>&1 && psvar[2]=
+}
+
+function prompt_zefram_setup {
+  PS1='[%(2L.%L/.)'$ZSH_VERSION']%(?..%B{%v}%b)%n%(2v.%B@%b.@)%m:%B%~%b%(!.#.>) '
+  PS2='%(4_:... :)%3_> '
+
+  precmd () { prompt_zefram_precmd; setopt promptsubst }
+  preexec () { }
+}
+
+prompt_zefram_setup "$@"