mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-08 12:01:21 +02:00
zsh-workers/8672
This commit is contained in:
parent
c996001c28
commit
1ed30d4586
4 changed files with 43 additions and 28 deletions
|
@ -1,9 +1,8 @@
|
||||||
DISTFILES_SRC='
|
DISTFILES_SRC='
|
||||||
.distfiles
|
.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_elite_setup prompt_redhat_setup prompt_adam2_setup
|
||||||
prompt_fire_setup prompt_suse_setup prompt_blue_setup
|
prompt_fire_setup prompt_suse_setup prompt_bigfade_setup
|
||||||
prompt_green_setup prompt_white_setup prompt_combo_setup
|
prompt_oliver_setup prompt_off_setup prompt_zefram_setup
|
||||||
prompt_magenta_setup prompt_yellow_setup prompt_cyan_setup
|
promptinit
|
||||||
prompt_oliver_setup prompt_off_setup promptinit
|
|
||||||
'
|
'
|
||||||
|
|
|
@ -46,20 +46,17 @@ prompt_adam2_setup () {
|
||||||
# This is a cute hack. Well I like it, anyway.
|
# 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_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_l_paren="%{$fg_bold[grey]%}("
|
||||||
prompt_r_paren=$'%{$fg_bold[grey]%})'
|
prompt_r_paren="%{$fg_bold[grey]%})"
|
||||||
|
|
||||||
prompt_l_bracket=$'%{$fg_bold[grey]%}['
|
|
||||||
prompt_r_bracket=$'%{$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_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_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="$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="$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]%}"
|
prompt_line_2="$prompt_gfx_bbox${prompt_gfx_hyphen}%{$fg_bold[white]%}"
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ prompt_fire_setup () {
|
||||||
local COLOR6="%{$bold_color$fg[$date]$bg[grey]%}"
|
local COLOR6="%{$bold_color$fg[$date]$bg[grey]%}"
|
||||||
local GRAD0="%{$reset_color%}"
|
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' '
|
PS2=$COLOR1$GRAD1$COLOR3$GRAD2$COLOR4$GRAD1$COLOR5'>'$GRAD0' '
|
||||||
|
|
||||||
precmd () { setopt promptsubst }
|
precmd () { setopt promptsubst }
|
||||||
|
|
|
@ -81,10 +81,11 @@ Use prompt -h <theme> for help on specific themes.'
|
||||||
print $prompt_themes
|
print $prompt_themes
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
p) if (( ! $+prompt_theme )); then
|
p) if [[ -z "$prompt_theme[1]" ]]; then
|
||||||
print "Cannot preview; current prompt is non-themeable and would"
|
# Not using a prompt theme; save settings
|
||||||
print "be destroyed."
|
prompt_non_theme=( "$PS1" "$PS2" "$PS3" "$PS4" "$RPS1" )
|
||||||
return
|
prompt_old_precmd="$(functions precmd)"
|
||||||
|
prompt_old_preexec="$(functions preexec)"
|
||||||
fi
|
fi
|
||||||
preview=( $prompt_themes )
|
preview=( $prompt_themes )
|
||||||
(( $#* > 1 )) && preview=( "$@[2,-1]" )
|
(( $#* > 1 )) && preview=( "$@[2,-1]" )
|
||||||
|
@ -97,10 +98,10 @@ Use prompt -h <theme> for help on specific themes.'
|
||||||
fi
|
fi
|
||||||
print
|
print
|
||||||
|
|
||||||
# The next line is a bit ugly. It (perhaps unnecessarily)
|
# The next line is a bit ugly. It (perhaps unnecessarily)
|
||||||
# runs the prompt theme setup function to ensure that if
|
# runs the prompt theme setup function to ensure that if
|
||||||
# the theme has a _preview function that it's been autoloaded.
|
# the theme has a _preview function that it's been autoloaded.
|
||||||
prompt_${theme_args[1]}_setup
|
prompt_${theme_args[1]}_setup
|
||||||
|
|
||||||
if functions prompt_${theme_args[1]}_preview >&/dev/null; then
|
if functions prompt_${theme_args[1]}_preview >&/dev/null; then
|
||||||
prompt_${theme_args[1]}_preview "${(@)theme_args[2,-1]}"
|
prompt_${theme_args[1]}_preview "${(@)theme_args[2,-1]}"
|
||||||
|
@ -109,7 +110,25 @@ Use prompt -h <theme> for help on specific themes.'
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
print
|
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"
|
s) print "Set and save not yet implemented. Please ensure your ~/.zshrc"
|
||||||
print "contains something similar to the following:\n"
|
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]"
|
print " prompt $*[2,-1]"
|
||||||
;;
|
;;
|
||||||
*) if [[ "$1" == 'random' ]]; then
|
*) if [[ "$1" == 'random' ]]; then
|
||||||
local random_themes
|
local random_themes
|
||||||
if (( $#* == 1 )); then
|
if (( $#* == 1 )); then
|
||||||
random_themes=( $prompt_themes )
|
random_themes=( $prompt_themes )
|
||||||
else
|
else
|
||||||
random_themes=( "$@[2,-1]" )
|
random_themes=( "$@[2,-1]" )
|
||||||
fi
|
fi
|
||||||
local i=$(( ( $RANDOM % $#random_themes ) + 1 ))
|
local i=$(( ( $RANDOM % $#random_themes ) + 1 ))
|
||||||
argv=( "${=random_themes[$i]}" )
|
argv=( "${=random_themes[$i]}" )
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue