about summary refs log tree commit diff
path: root/Functions/Prompts/prompt_adam1_setup
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
commit17a3040fb730b71414f97d33474e995a3f80eb14 (patch)
tree252a8fa4b8f534e2c4031101924a36d7fa607573 /Functions/Prompts/prompt_adam1_setup
parent7d6621bcef33ec8c38fa5ebaff1d9201b18e8069 (diff)
downloadzsh-17a3040fb730b71414f97d33474e995a3f80eb14.tar.gz
zsh-17a3040fb730b71414f97d33474e995a3f80eb14.tar.xz
zsh-17a3040fb730b71414f97d33474e995a3f80eb14.zip
manual/8668
Diffstat (limited to 'Functions/Prompts/prompt_adam1_setup')
-rw-r--r--Functions/Prompts/prompt_adam1_setup29
1 files changed, 26 insertions, 3 deletions
diff --git a/Functions/Prompts/prompt_adam1_setup b/Functions/Prompts/prompt_adam1_setup
index 65d1b68c0..19b7737eb 100644
--- a/Functions/Prompts/prompt_adam1_setup
+++ b/Functions/Prompts/prompt_adam1_setup
@@ -1,7 +1,30 @@
 # adam1 prompt theme
 
+prompt_adam1_help () {
+  cat <<'EOF'
+This prompt is color-scheme-able.  You can invoke it thus:
+
+  prompt adam1 [<color1> [<color2> [<color3>]]]
+
+where the colors are for the user@host background, current working
+directory, and current working directory if the prompt is split over
+two lines respectively.  The default colors are blue, cyan and green.
+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, then specify the `plain' option to use 7-bit
+replacements for the 8-bit characters.
+
+And you probably thought adam1 was overkill.
+EOF
+}
+
 prompt_adam1_setup () {
-  base_prompt="%{$bg_no_bold_blue%}%n@%m%{$reset_color%} "
+  prompt_adam1_color1=${1:-'blue'}
+  prompt_adam1_color2=${2:-'cyan'}
+  prompt_adam1_color3=${3:-'green'}
+
+  base_prompt="%{$bg_no_bold[$prompt_adam1_color1]%}%n@%m%{$reset_color%} "
   post_prompt="%{$reset_color%}"
 
   base_prompt_no_color=$(echo "$base_prompt" | perl -pe "s/%{.*?%}//g")
@@ -20,10 +43,10 @@ prompt_adam1_precmd () {
   base_prompt_etc=$(print -P "$base_prompt%(4~|...|)%3~")
   prompt_length=${#base_prompt_etc}
   if [[ $prompt_length -lt 40 ]]; then
-    path_prompt="%{$fg_bold_cyan%}%(4~|...|)%3~%{$fg_bold_white%}"
+    path_prompt="%{$fg_bold[$prompt_adam1_color2]%}%(4~|...|)%3~%{$fg_bold[white]%}"
   else
     space_left=$(( $COLUMNS - $#base_prompt_expanded_no_color - 2 ))
-    path_prompt="%{$fg_bold_green%}%${space_left}<...<%~$prompt_newline%{$fg_bold_white%}"
+    path_prompt="%{$fg_bold[$prompt_adam1_color3]%}%${space_left}<...<%~$prompt_newline%{$fg_bold_white%}"
   fi
   PS1="$base_prompt$path_prompt %# $post_prompt"
   PS2="$base_prompt$path_prompt %_> $post_prompt"