1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-03 10:21:46 +02:00

zsh-workers/8672

This commit is contained in:
Tanaka Akira 1999-11-19 09:15:31 +00:00
parent c996001c28
commit 1ed30d4586
4 changed files with 43 additions and 28 deletions

View file

@ -1,9 +1,8 @@
DISTFILES_SRC='
.distfiles
prompt_elite2_setup prompt_red_setup prompt_adam1_setup
prompt_elite2_setup prompt_adam1_setup prompt_fade_setup
prompt_elite_setup prompt_redhat_setup prompt_adam2_setup
prompt_fire_setup prompt_suse_setup prompt_blue_setup
prompt_green_setup prompt_white_setup prompt_combo_setup
prompt_magenta_setup prompt_yellow_setup prompt_cyan_setup
prompt_oliver_setup prompt_off_setup promptinit
prompt_fire_setup prompt_suse_setup prompt_bigfade_setup
prompt_oliver_setup prompt_off_setup prompt_zefram_setup
promptinit
'

View file

@ -46,20 +46,17 @@ prompt_adam2_setup () {
# This is a cute hack. Well I like it, anyway.
prompt_gfx_bbox_to_mbox=$(print -n "%{\e[A\r$fg_bold[$prompt_adam2_color1]${prompt_gfx_mlc}$fg_no_bold[$prompt_adam2_color1]${prompt_gfx_hyphen}\e[B%}")
prompt_l_paren=$'%{$fg_bold[grey]%}('
prompt_r_paren=$'%{$fg_bold[grey]%})'
prompt_l_bracket=$'%{$fg_bold[grey]%}['
prompt_r_bracket=$'%{$fg_bold[grey]%}]'
prompt_l_paren="%{$fg_bold[grey]%}("
prompt_r_paren="%{$fg_bold[grey]%})"
prompt_machine="%{$fg_no_bold[$prompt_adam2_color3]%}%n%{$fg_bold[$prompt_adam2_color3]%}@%{$fg_no_bold[$prompt_adam2_color3]%}%m"
prompt_padding_text=`perl -e "print qq{${prompt_gfx_hyphen}} x 200"`
prompt_line_1a="$prompt_gfx_tbox$prompt_l_paren%{$fg_bold[$prompt_adam2_color2]%}%~$prompt_r_paren%{$fg_no_bold[$prompt_adam2_color1]%}"
prompt_line_1a_no_color=$(echo "$prompt_line_1a" | perl -pe "s/%{.*?%}//g")
prompt_line_1a_no_color=$(echo "$prompt_line_1a" | perl -pe 's/%{.*?%}//g')
prompt_line_1b="$prompt_l_paren$prompt_machine$prompt_r_paren%{$fg_no_bold[$prompt_adam2_color1]%}${prompt_gfx_hyphen}"
prompt_line_1b_no_color=$(echo "$prompt_line_1b" | perl -pe "s/%{.*?%}//g")
prompt_line_1b_no_color=$(echo "$prompt_line_1b" | perl -pe 's/%{.*?%}//g')
prompt_line_2="$prompt_gfx_bbox${prompt_gfx_hyphen}%{$fg_bold[white]%}"

View file

@ -43,7 +43,7 @@ prompt_fire_setup () {
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} '$NONE'$prompt_newline'$COLOR5'%~/'$GRAD0' '
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 () { setopt promptsubst }

View file

@ -81,10 +81,11 @@ Use prompt -h <theme> for help on specific themes.'
print $prompt_themes
return
;;
p) if (( ! $+prompt_theme )); then
print "Cannot preview; current prompt is non-themeable and would"
print "be destroyed."
return
p) if [[ -z "$prompt_theme[1]" ]]; then
# Not using a prompt theme; save settings
prompt_non_theme=( "$PS1" "$PS2" "$PS3" "$PS4" "$RPS1" )
prompt_old_precmd="$(functions precmd)"
prompt_old_preexec="$(functions preexec)"
fi
preview=( $prompt_themes )
(( $#* > 1 )) && preview=( "$@[2,-1]" )
@ -97,10 +98,10 @@ Use prompt -h <theme> for help on specific themes.'
fi
print
# The next line is a bit ugly. It (perhaps unnecessarily)
# runs the prompt theme setup function to ensure that if
# the theme has a _preview function that it's been autoloaded.
prompt_${theme_args[1]}_setup
# The next line is a bit ugly. It (perhaps unnecessarily)
# runs the prompt theme setup function to ensure that if
# the theme has a _preview function that it's been autoloaded.
prompt_${theme_args[1]}_setup
if functions prompt_${theme_args[1]}_preview >&/dev/null; then
prompt_${theme_args[1]}_preview "${(@)theme_args[2,-1]}"
@ -109,7 +110,25 @@ Use prompt -h <theme> for help on specific themes.'
fi
done
print
prompt_${prompt_theme[1]}_setup "${(@)prompt_theme[2,-1]}"
if [[ -z "$prompt_theme[1]" ]]; then
PS1="$prompt_non_theme[1]"
PS2="$prompt_non_theme[2]"
PS3="$prompt_non_theme[3]"
PS4="$prompt_non_theme[4]"
RPS1="$prompt_non_theme[5]"
if [[ -z "$prompt_old_precmd" ]]; then
precmd () { }
else
eval "$prompt_old_precmd"
fi
if [[ -z "$prompt_old_preexec" ]]; then
preexec () { }
else
eval "$prompt_old_preexec"
fi
else
prompt_${prompt_theme[1]}_setup "${(@)prompt_theme[2,-1]}"
fi
;;
s) print "Set and save not yet implemented. Please ensure your ~/.zshrc"
print "contains something similar to the following:\n"
@ -118,12 +137,12 @@ Use prompt -h <theme> for help on specific themes.'
print " prompt $*[2,-1]"
;;
*) if [[ "$1" == 'random' ]]; then
local random_themes
if (( $#* == 1 )); then
random_themes=( $prompt_themes )
else
random_themes=( "$@[2,-1]" )
fi
local random_themes
if (( $#* == 1 )); then
random_themes=( $prompt_themes )
else
random_themes=( "$@[2,-1]" )
fi
local i=$(( ( $RANDOM % $#random_themes ) + 1 ))
argv=( "${=random_themes[$i]}" )
fi