diff options
author | Bart Schaefer <barts@users.sourceforge.net> | 2005-05-10 04:38:54 +0000 |
---|---|---|
committer | Bart Schaefer <barts@users.sourceforge.net> | 2005-05-10 04:38:54 +0000 |
commit | d0a12b9d7bf8794c1fd4b490501ee167aa62b511 (patch) | |
tree | e4e2e6189b4feefbf034784471b3c64d9efba95c /Functions | |
parent | 0d34cdcb0d6ff553582b68de2d21aa434c93d2ab (diff) | |
download | zsh-d0a12b9d7bf8794c1fd4b490501ee167aa62b511.tar.gz zsh-d0a12b9d7bf8794c1fd4b490501ee167aa62b511.tar.xz zsh-d0a12b9d7bf8794c1fd4b490501ee167aa62b511.zip |
Misc. prompt theme repairs
Diffstat (limited to 'Functions')
-rw-r--r-- | Functions/Prompts/prompt_bart_setup | 5 | ||||
-rw-r--r-- | Functions/Prompts/prompt_bigfade_setup | 5 | ||||
-rw-r--r-- | Functions/Prompts/prompt_elite2_setup | 14 | ||||
-rw-r--r-- | Functions/Prompts/prompt_elite_setup | 44 | ||||
-rw-r--r-- | Functions/Prompts/prompt_fade_setup | 5 | ||||
-rw-r--r-- | Functions/Prompts/prompt_fire_setup | 74 | ||||
-rw-r--r-- | Functions/Prompts/promptinit | 1 |
7 files changed, 107 insertions, 41 deletions
diff --git a/Functions/Prompts/prompt_bart_setup b/Functions/Prompts/prompt_bart_setup index 2f0e44f43..0826d1872 100644 --- a/Functions/Prompts/prompt_bart_setup +++ b/Functions/Prompts/prompt_bart_setup @@ -180,4 +180,9 @@ prompt_bart_setup () { return 0 } +prompt_bart_preview () { + local +h PS1='%# ' + prompt_preview_theme bart "$@" +} + [[ -o kshautoload ]] || prompt_bart_setup "$@" diff --git a/Functions/Prompts/prompt_bigfade_setup b/Functions/Prompts/prompt_bigfade_setup index 260c0ddf0..3b73c1e0f 100644 --- a/Functions/Prompts/prompt_bigfade_setup +++ b/Functions/Prompts/prompt_bigfade_setup @@ -25,9 +25,8 @@ prompt_bigfade_setup () { 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")} + for code in 333 262 261 260; do + local char_$code=$(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%} " diff --git a/Functions/Prompts/prompt_elite2_setup b/Functions/Prompts/prompt_elite2_setup index 7e7748ec7..41080187b 100644 --- a/Functions/Prompts/prompt_elite2_setup +++ b/Functions/Prompts/prompt_elite2_setup @@ -20,19 +20,21 @@ prompt_elite2_setup () { 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")} + for code in 332 304 300; do + local char_$code=$(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 punct="%{$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 " + local lpar="$parens($text" + local rpar="$parens)$text" - PS2="$parensÄ$textÄ$punctuation_color-$reset " + PS1="$punct$char_332$text$char_304$lpar%n$punct@$text%m$rpar$char_304$lpar%!$punct/$text%y$rpar$char_304$lpar%D{%I:%M%P}$punct:$text%D{%m/%d/%y}$rpar$char_304$punct-$reset$prompt_newline$punct$char_300$text$char_304$lpar%#$punct:$text%~$rpar$char_304$punct-$reset " + + PS2="$parens$char_304$text$char_304$punct-$reset " precmd () { setopt promptsubst } preexec () { } diff --git a/Functions/Prompts/prompt_elite_setup b/Functions/Prompts/prompt_elite_setup index e5b43fc84..53216c52a 100644 --- a/Functions/Prompts/prompt_elite_setup +++ b/Functions/Prompts/prompt_elite_setup @@ -1,18 +1,44 @@ -# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net> - -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 - # Created by KrON from windowmaker on IRC # Changed by Spidey 08/06 +# Converted to zsh prompt theme by <adam@spiers.net> + +prompt_elite_help () { + cat <<EOH +This prompt is color-scheme-able. You can invoke it thus: + + prompt elite [<text-color> [<punctuation-color>]] + +The default colors are red and blue respectively. This theme is +intended for use with a black 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_elite_setup () { - PS1="%{$fg_red%}$char_332$char_304%{$fg_blue%}(%{$fg_red%}%n%{$fg_blue%}@%{$fg_red%}%m%{$fg_blue%})%{$fg_red%}-%{$fg_blue%}(%{$fg_red%}%D{%I:%M%P}%{$fg_blue%}-:-%{$fg_red%}%D{%m}%{$fg_blue$fg_red%}/%D{%d}%{$fg_blue%})%{$fg_red%}$char_304-%{$fg_blue]%}$char_371%{$fg_red%}-$char_371$char_371%{$fg_blue%}$char_372$prompt_newline%{$fg_red%}$char_300$char_304%{$fg_blue%}(%{$fg_red%}%1~%{$fg_blue%})%{$fg_red%}$char_304$char_371%{$fg_blue%}$char_372%{$reset_color%}" + local text=${1:-'red'} + local punctuation=${2:-'blue'} + + for code in 332 304 371 372 300; do + local char_$code=$(echo -n "\\0$code") + done + + PS1="%{$fg[$text]%}$char_332$char_304%{$fg[$punctuation]%}(%{$fg[$text]%}%n%{$fg[$punctuation]%}@%{$fg[$text]%}%m%{$fg[$punctuation]%})%{$fg[$text]%}-%{$fg[$punctuation]%}(%{$fg[$text]%}%D{%I:%M%P}%{$fg[$punctuation]%}-:-%{$fg[$text]%}%D{%m}%{$fg[$punctuation]$fg[$text]%}/%D{%d}%{$fg[$punctuation]%})%{$fg[$text]%}$char_304-%{$fg[$punctuation]]%}$char_371%{$fg[$text]%}-$char_371$char_371%{$fg[$punctuation]%}$char_372$prompt_newline%{$fg[$text]%}$char_300$char_304%{$fg[$punctuation]%}(%{$fg[$text]%}%1~%{$fg[$punctuation]%})%{$fg[$text]%}$char_304$char_371%{$fg[$punctuation]%}$char_372%{$reset_color%}" PS2="> " - precmd () { } + precmd () { setopt promptsubst } preexec () { } } +prompt_elite_preview () { + if (( ! $#* )); then + prompt_preview_theme elite + print + prompt_preview_theme elite green yellow + else + prompt_preview_theme elite "$@" + fi +} + prompt_elite_setup "$@" diff --git a/Functions/Prompts/prompt_fade_setup b/Functions/Prompts/prompt_fade_setup index 5b49f6105..ab908e41e 100644 --- a/Functions/Prompts/prompt_fade_setup +++ b/Functions/Prompts/prompt_fade_setup @@ -27,9 +27,8 @@ prompt_fade_setup () { 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")} + for code in 333 262 261 260; do + local char_$code=$(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%} " diff --git a/Functions/Prompts/prompt_fire_setup b/Functions/Prompts/prompt_fire_setup index bd26dd10a..34676d159 100644 --- a/Functions/Prompts/prompt_fire_setup +++ b/Functions/Prompts/prompt_fire_setup @@ -1,28 +1,62 @@ -# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net> - -for code in 333 262 261 260 260 261 262 333; do - local varname=char_$code - : ${(P)varname=$(echo -n "\\0$code")} -done - +# Fire prompt theme from bashprompt # Inspired by Raster (Carsten Haitzler of Red Hat Advanced Development Labs) # Created by BadlandZ # Changed by Spidey 08/06 +# Converted to zsh prompt theme by <adam@spiers.net> + +prompt_fire_help () { + cat <<EOH +This prompt is color-scheme-able. You can invoke it thus: + + prompt fire [<fire1> [<fire2> [<fire3> [<userhost> [<date> [<cwd>]]]]]] + +where the parameters are the three fire colors, and the colors for the +user@host text, date text, and current working directory respectively. +The default colors are yellow, yellow, red, 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_fire_setup () { - local GRAD1='%{$char_333$char_262$char_261$char_260%}' - local GRAD2='%{$char_260$char_261$char_262$char_333%}' - local COLOR1='%{$bold_color$fg_yellow$bg_yellow%}' - local COLOR2='%{$bold_color$fg_white$bg_yellow%}' - local COLOR3='%{$reset_color$fg_red$bg_yellow%}' - local COLOR4='%{$reset_color$fg_red$bg_grey%}' - local COLOR5='%{$bold_color$fg_yellow$bg_grey%}' - local COLOR6='%{$bold_color$fg_white$bg_grey%}' - local GRAD0='%{$reset_color%}' - PS1=$COLOR1$GRAD1$COLOR2'%n@%m'$COLOR3$GRAD2$COLOR4$GRAD1$COLOR6' %D{%a %b %d} %D{%I:%M:%S%P} '$NONE'$prompt_newline'$COLOR5'%~/'$GRAD0' ' - PS2=$COLOR1$GRAD1$COLOR3$GRAD2$COLOR4$GRAD1$COLOR5'>'$GRAD0' ' - - precmd () { } + local fire1=${1:-'yellow'} + local fire2=${2:-'yellow'} + local fire3=${3:-'red'} + local userhost=${4:-'white'} + local date=${5:-'white'} + local cwd=${6:-'yellow'} + + for code in 333 262 261 260; do + local char_$code=$(echo -n "\\0$code") + done + + local GRAD1="%{$char_333$char_262$char_261$char_260%}" + local GRAD2="%{$char_260$char_261$char_262$char_333%}" + local COLOR1="%{$bold_color$fg[$fire1]$bg[$fire2]%}" + local COLOR2="%{$bold_color$fg[$userhost]$bg[$fire2]%}" + local COLOR3="%{$reset_color$fg[$fire3]$bg[$fire2]%}" + local COLOR4="%{$reset_color$fg[$fire3]$bg[grey]%}" + local COLOR5="%{$bold_color$fg[$cwd]$bg[grey]%}" + local COLOR6="%{$bold_color$fg[$date]$bg[grey]%}" + local GRAD0="%{$reset_color%}" + + PS1=$COLOR1$GRAD1$COLOR2'%n@%m'$COLOR3$GRAD2$COLOR4$GRAD1$COLOR6' %D{%a %b %d} %D{%I:%M:%S%P} '$prompt_newline$COLOR5'%~/'$GRAD0' ' + PS2=$COLOR1$GRAD1$COLOR3$GRAD2$COLOR4$GRAD1$COLOR5'>'$GRAD0' ' + + precmd () { setopt promptsubst } preexec () { } } +prompt_fire_preview () { + if (( ! $#* )); then + prompt_preview_theme fire + print + prompt_preview_theme fire red magenta blue white white white + else + prompt_preview_theme fire "$@" + fi +} + prompt_fire_setup "$@" diff --git a/Functions/Prompts/promptinit b/Functions/Prompts/promptinit index 4ccdcf55b..0ca4f86bf 100644 --- a/Functions/Prompts/promptinit +++ b/Functions/Prompts/promptinit @@ -185,6 +185,7 @@ prompt_preview_theme () { print ":" prompt_${1}_setup "$@[2,-1]" precmd + [[ -o promptcr ]] && print -n $'\r'; : print -P "${PS1}command arg1 arg2 ... argn" preexec } |