From 3140ebd0f5f6110ec8ba2b271be8595393b59aca Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 14 May 2009 14:33:08 +0200 Subject: [Colors] simplification of PS1_USER colors, and moved them into Environment --- 10_Environment.zsh | 17 +++++++++++++++++ 11_Colors.zsh | 20 -------------------- 12_Prompts.zsh | 20 +------------------- net:eurodec/host:osn08002/Colors.zsh | 4 ---- net:eurodec/host:osn08002/Environment.zsh | 3 +++ .../host:openwide-desktop/Environment.zsh | 2 +- net:opera.openwide.fr/host:vlab/Environment.zsh | 4 ++-- net:sweethome/host:prunelle/Environment.zsh | 1 - net:sweethome/user:hugues/Environment.zsh | 19 +++++++++++++++++++ 9 files changed, 43 insertions(+), 47 deletions(-) delete mode 100644 net:eurodec/host:osn08002/Colors.zsh create mode 100644 net:sweethome/user:hugues/Environment.zsh diff --git a/10_Environment.zsh b/10_Environment.zsh index 158aae3..c7e098b 100644 --- a/10_Environment.zsh +++ b/10_Environment.zsh @@ -29,6 +29,21 @@ _c=m C_="%{$c_" _C="$_c%}" +# I hate kik00l0l colorized prompts, so I'm using a way to +# give a dominant color for each part of the prompt, each of +# these remain still configurable one by one. +# Take a look to set_prompt_colors for these colorizations. +# +# To set the dominant color I'm using this : +# +# - PS1_ROOT when we are root +# - PS1_USER for normal usage +# +# I'm storing the resulting dominant color in $prompt_colors[generic] + +PS1_ROOT=${PS1_ROOT:-$color[red]} +PS1_USER=${PS1_USER:-$color[blue]} + ## Variables d'environnement ``classiques'' # # L'utilisation de la forme ${VARIABLE:+$VARIABLE:} permet d'accoler ``:'' @@ -54,3 +69,5 @@ HISTSIZE=42000 SAVEHIST=42000 export GPG_TTY=`tty` + + diff --git a/11_Colors.zsh b/11_Colors.zsh index 43c488b..63c20e2 100644 --- a/11_Colors.zsh +++ b/11_Colors.zsh @@ -9,26 +9,6 @@ ## typeset -A prompt_colors git_colors mail_colors correct_colors battery_colors date_colors agent_colors -# I hate kik00l0l colorized prompts, so I'm using a way to -# give a dominant color for each part of the prompt, each of -# these remain still configurable one by one. -# Take a look to set_prompt_colors for these colorizations. -# -# To set the dominant color I'm using this : -# -# - PS1_ROOT when we are root -# - PS1_USER for normal usage -# - PS1_USER_SSH when we are connected through SSH -# -# I'm storing the resulting dominant color in $prompt_colors[generic] - -PS1_ROOT=${PS1_ROOT:-$color[red]} -PS1_USER=${PS1_USER:-$color[blue]} -PS1_SUDO=${PS1_SUDO:-$color[green]} -PS1_USER_SSH=${PS1_USER_SSH:-$color[magenta]} -#PS1_USER_SCR=${PS1_USER_SCR:-$color[cyan]} -PS1_USER_SCR=$PS1_USER - correct_colors[error]="$color[red];$color[bold]" correct_colors[suggest]="$color[blue];$color[bold]" diff --git a/12_Prompts.zsh b/12_Prompts.zsh index e762a6b..bdbb55a 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -11,25 +11,7 @@ prompt_colors[generic]=${PS1_USER:-} if privileged_user then - prompt_colors[generic]=${PS1_ROOT:-$color[red]} -else - if ( [ "$SSH_TTY" != "" ] ) - then - # This allows us to easily distinguish shells - # which really are on the local machine or not. - # That's so good, use it ! :-) - prompt_colors[generic]=${PS1_USER_SSH:-$PS1_USER} - fi - if ( echo "$TERM" | grep "^screen.*$" >/dev/null ) - then - # Are we under a screen session ? - prompt_colors[generic]=${PS1_USER_SCR:-$PS1_USER} - fi - if ( [ ! -z "$SUDO_USER" ] ) - then - # Are we sudo-ed under another user than root ? - prompt_colors[generic]=${PS1_SUDO:-$PS1_USER} - fi + prompt_colors[generic]=${PS1_ROOT:-$color[bold];$color[red]} fi set_prompt_colors diff --git a/net:eurodec/host:osn08002/Colors.zsh b/net:eurodec/host:osn08002/Colors.zsh deleted file mode 100644 index a43eaef..0000000 --- a/net:eurodec/host:osn08002/Colors.zsh +++ /dev/null @@ -1,4 +0,0 @@ - -PS1_USER=$color[white] -PS1_USER_SSH=$PS1_USER - diff --git a/net:eurodec/host:osn08002/Environment.zsh b/net:eurodec/host:osn08002/Environment.zsh index 35b1dde..d21d723 100644 --- a/net:eurodec/host:osn08002/Environment.zsh +++ b/net:eurodec/host:osn08002/Environment.zsh @@ -1,3 +1,6 @@ [ "$TERM" = "rxvt-unicode" ] && export TERM=rxvt-color + +PS1_USER=$color[white] + diff --git a/net:opera.openwide.fr/host:openwide-desktop/Environment.zsh b/net:opera.openwide.fr/host:openwide-desktop/Environment.zsh index 2dfa543..f5588d0 100644 --- a/net:opera.openwide.fr/host:openwide-desktop/Environment.zsh +++ b/net:opera.openwide.fr/host:openwide-desktop/Environment.zsh @@ -1,4 +1,4 @@ + PS1_USER=$color[yellow] -PS1_USER_SSH=$PS1_USER source /etc/dash.conf diff --git a/net:opera.openwide.fr/host:vlab/Environment.zsh b/net:opera.openwide.fr/host:vlab/Environment.zsh index f38d7da..17a5003 100644 --- a/net:opera.openwide.fr/host:vlab/Environment.zsh +++ b/net:opera.openwide.fr/host:vlab/Environment.zsh @@ -1,3 +1,3 @@ + PS1_USER=$color[red] -PS1_USER_SSH=$PS1_USER -PS1_USER_SCR=$PS1_USER + diff --git a/net:sweethome/host:prunelle/Environment.zsh b/net:sweethome/host:prunelle/Environment.zsh index 876fb90..248b742 100644 --- a/net:sweethome/host:prunelle/Environment.zsh +++ b/net:sweethome/host:prunelle/Environment.zsh @@ -27,7 +27,6 @@ then fi PS1_USER="1" -PS1_USER_SSH="$PS1_USER" if [ "$OSTYPE" = "linux-gnu" ] then PS1_ROOT="31" diff --git a/net:sweethome/user:hugues/Environment.zsh b/net:sweethome/user:hugues/Environment.zsh new file mode 100644 index 0000000..22ede24 --- /dev/null +++ b/net:sweethome/user:hugues/Environment.zsh @@ -0,0 +1,19 @@ + +PS1_SUDO=${PS1_SUDO:-$color[green]} +PS1_USER_SSH=${PS1_USER_SSH:-$color[magenta]} +#PS1_USER_SCR=${PS1_USER_SCR:-$color[cyan]} +PS1_USER_SCR=$PS1_USER + +if ( [ "$SSH_TTY" != "" ] ) +then + PS1_USER=$PS1_USER_SSH +fi +if ( echo "$TERM" | grep "^screen.*$" >/dev/null ) +then + PS1_USER=$PS1_USER_SCR +fi +if ( [ ! -z "$SUDO_USER" ] ) +then + PS1_USER=$PS1_SUDO +fi + -- cgit v1.2.3