1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-30 05:40:58 +01:00

Misc. prompt theme repairs

This commit is contained in:
Bart Schaefer 2005-05-10 04:38:54 +00:00
parent 0d34cdcb0d
commit d0a12b9d7b
8 changed files with 118 additions and 41 deletions

View file

@ -180,4 +180,9 @@ prompt_bart_setup () {
return 0
}
prompt_bart_preview () {
local +h PS1='%# '
prompt_preview_theme bart "$@"
}
[[ -o kshautoload ]] || prompt_bart_setup "$@"

View file

@ -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%} "

View file

@ -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 () { }

View file

@ -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 "$@"

View file

@ -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%} "

View file

@ -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
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' '
# Converted to zsh prompt theme by <adam@spiers.net>
precmd () { }
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 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 "$@"

View file

@ -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
}