diff options
author | Clint Adams <clint@users.sourceforge.net> | 2001-05-27 05:03:10 +0000 |
---|---|---|
committer | Clint Adams <clint@users.sourceforge.net> | 2001-05-27 05:03:10 +0000 |
commit | 31252df2991204dfc596b64a41db65e19771d323 (patch) | |
tree | 918e41f2c55d8dfae40c301a5537055e6445c38c | |
parent | fb22648e8ccc3312fab73ac5a46b40576264f58e (diff) | |
download | zsh-31252df2991204dfc596b64a41db65e19771d323.tar.gz zsh-31252df2991204dfc596b64a41db65e19771d323.tar.xz zsh-31252df2991204dfc596b64a41db65e19771d323.zip |
14492: new prompt theme
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Functions/Prompts/.distfiles | 2 | ||||
-rw-r--r-- | Functions/Prompts/prompt_clint_setup | 73 |
3 files changed, 80 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index a47d3cd0f..796886995 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-05-27 Clint Adams <clint@zsh.org> + + * 14492: Functions/Prompts/.distfiles, + Functions/Prompts/prompt_clint_setup: + additional prompt theme. + 2001-05-26 Wayne Davison <wayned@users.sourceforge.net> * 14488: Src/Zle/zle_hist.c: fixed accept-and-infer-next-history diff --git a/Functions/Prompts/.distfiles b/Functions/Prompts/.distfiles index e9c6a6317..7395260b6 100644 --- a/Functions/Prompts/.distfiles +++ b/Functions/Prompts/.distfiles @@ -4,5 +4,5 @@ prompt_adam1_setup prompt_elite_setup prompt_redhat_setup prompt_adam2_setup prompt_fade_setup prompt_suse_setup prompt_bart_setup prompt_fire_setup prompt_zefram_setup prompt_bigfade_setup prompt_off_setup promptinit -prompt_elite2_setup prompt_oliver_setup +prompt_elite2_setup prompt_oliver_setup prompt_clint_setup ' diff --git a/Functions/Prompts/prompt_clint_setup b/Functions/Prompts/prompt_clint_setup new file mode 100644 index 000000000..92decb8f6 --- /dev/null +++ b/Functions/Prompts/prompt_clint_setup @@ -0,0 +1,73 @@ +# clint prompt theme + +prompt_clint_help () { + cat <<'EOF' + + prompt clint [<color1> [<color2> [<color3> [<color4> [<color5>]]]]] + + defaults are red, cyan, green, yellow, and white, respectively. + +EOF +} + +prompt_clint_setup () { + local -a pcc + local -A pc + local p_date p_tty p_plat p_ver p_userpwd p_apm p_shlvlhist p_rc p_end + + pcc[1]=${1:-'red'} + pcc[2]=${2:-'cyan'} + pcc[3]=${3:-'green'} + pcc[4]=${4:-'yellow'} + pcc[5]=${5:-'white'} + + pc['\[']="%{$fg_no_bold[$pcc[1]]%}[" + pc['\]']="%{$fg_no_bold[$pcc[1]]%}]" + pc['<']="%{$fg_no_bold[$pcc[1]]%}<" + pc['>']="%{$fg_no_bold[$pcc[1]]%}>" + + p_date="$pc['\[']%{$fg_no_bold[$pcc[2]]%}%D{%a %y/%m/%d %R %Z}$pc['\]']" + p_tty="$pc['\[']%{$fg_no_bold[$pcc[3]]%}%l$pc['\]']" + p_plat="$pc['\[']%{$fg_no_bold[$pcc[2]]%}${MACHTYPE}/${OSTYPE}/$(uname -r)$pc['\]']" + p_ver="$pc['\[']%{$fg_no_bold[$pcc[2]]%}${ZSH_VERSION}$pc['\]']" + + p_userpwd="$pc['<']%{$fg_no_bold[$pcc[3]]%}%n@%m%{$fg_bold[$pcc[5]]%}:%{$fg_no_bold[$pcc[4]]%}%~$pc['>']" + [[ -f /proc/apm ]] && p_apm="%(2v.-%2v-.)" + + p_shlvlhist="%{$reset_color%}zsh%(2L./$SHLVL.) %B%h%b " + p_rc="%(?..[%?%v1] )" + p_end="%{$reset_color%}%B%#%b %{$fg_no_bold[$pcc[2]]%}" + + POSTEDIT="$reset_color" + + prompt="$p_date$p_tty$p_plat$p_ver +$p_userpwd +$p_shlvlhist$p_rc$p_apm$p_end" + PS2='%(4_.\.)%3_> %E' + + [[ -f /proc/apm ]] && + precmd () { prompt_clint_precmd ; prompt_clint_apm_precmd } || + precmd () { prompt_clint_precmd } + preexec () { } +} + +prompt_clint_precmd () { + setopt noxtrace localoptions + local exitstatus=$? + + [[ $exitstatus -ge 128 ]] && psvar[1]=" $signals[$exitstatus-127]" || + psvar[1]="" + + [[ -o interactive ]] && jobs -l + +} + +prompt_clint_apm_precmd () { + setopt noxtrace localoptions + local bat + + bat=${${="$(</proc/apm)"}[7]/%/%%} + [[ $bat == "100%" ]] && psvar[2]=() || psvar[2]=$bat +} + +prompt_clint_setup "$@" |