From ab612bfeb17debe4c8c00a012b71e09e1c51bee3 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 19 Jan 2012 14:11:04 +0100 Subject: [Funcs] Better d1RtY zsh managment --- 01_Functions.zsh | 2 +- 10_Environment.zsh | 1 + 12_Prompts.zsh | 38 +++++++++++++++++++++++++------------- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/01_Functions.zsh b/01_Functions.zsh index 108d4f8..d942dab 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -368,7 +368,7 @@ set_prompt_colors () prompt_colors[braces]="$prompt_colors[bar]" # braces (around date) - bar color prompt_colors[error]="$color[bold];$color[yellow]" # error code - bold yellow - prompt_colors[warning]="$color[bold];$color[black]" + prompt_colors[warning]="$color[bold];$color[yellow]" date_colors[normal]=$prompt_colors[soft_generic] date_colors[exec]=$prompt_colors[bold_generic] diff --git a/10_Environment.zsh b/10_Environment.zsh index 48d416f..1584c57 100644 --- a/10_Environment.zsh +++ b/10_Environment.zsh @@ -37,6 +37,7 @@ _t_l=${${has_termcaps:+l}:-]} _t_m=${${has_termcaps:+m}:-]} _t_t=${${has_termcaps:+t}:-]} _t_u=${${has_termcaps:+u}:-[} +_t_x=${${has_termcaps:+x}:-|} # I hate kik00l0l colorized prompts, so I'm using a way to # give a dominant color for each part of the prompt, each of diff --git a/12_Prompts.zsh b/12_Prompts.zsh index fd0f61f..418e316 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -339,11 +339,27 @@ two_lines_prompt () ZSH_STATUS=$(zsh_status) if ( echo $ZSH_STATUS | grep -q -- "-D1rTY-" ) then - set_prompt_colors "$color[black]" - #echo -n $c_$prompt_colors[warning]$_c + echo + echo -n $c_$prompt_colors[warning]$_c #toilet -f bigmono9 "D1rTY Zsh.." - #echo $c_$prompt_colors[none]$_c - #echo + + HBAR=$(for i in {1..13} ; echo -n $_t_q) + VBAR=$T_$_t_x$_T + + echo -n " " + echo -n $T_$_t_l + echo -n $HBAR + echo -n $_t_k$_T + echo + echo " $VBAR WARNING !! $VBAR" + echo " $VBAR D1rTY Zsh.. $VBAR" + + echo -n " " + echo -n $T_$_t_m + echo -n $HBAR + echo -n $_t_j$_T + echo + echo $c_$prompt_colors[none]$_c fi precmd() @@ -351,21 +367,17 @@ precmd() # this MUST BE the real first operation else we lose the error code... error=$(print -Pn "%(?;;-%?)") + # d1RtY Zsh ... + ( echo $NEW_STATUS | grep -q -- "-D1rTY-" ) && set_prompt_colors "38;5;$(( $RANDOM % ( 88 - 16 ) + 16))" + NEW_STATUS=$(zsh_status) - if [ $NEW_STATUS != $ZSH_STATUS ] + if ! ( echo $NEW_STATUS | grep -q -- "-D1rTY-" ) then - if ! ( echo $NEW_STATUS | grep -q -- "-D1rTY-" ) + if [ $NEW_STATUS != $ZSH_STATUS ] then # You should restart Zsh set_prompt_colors "38;5;54" fi - - else - if ( echo $ZSH_STATUS | grep -q -- "-D1rTY-" ) - then - # Your Zsh working copy is not clean - set_prompt_colors "38;5;81" - fi fi update_prompt_elements -- cgit v1.2.3