From 27582116d6ffe087da0844fd5b67b513bfcb2b09 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 5 Feb 2009 15:39:26 +0100 Subject: [Colors] better managment of colors... --- 11_Colors.zsh | 30 +++++++++++++++++------------- 12_Prompts.zsh | 1 + 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/11_Colors.zsh b/11_Colors.zsh index 00d405d..3debc13 100644 --- a/11_Colors.zsh +++ b/11_Colors.zsh @@ -26,19 +26,6 @@ PS1_ROOT=${PS1_ROOT:-$color[red]} PS1_USER=${PS1_USER:-$color[blue]} PS1_USER_SSH=${PS1_USER_SSH:-$color[magenta]} PS1_USER_SCR=${PS1_USER_SCR:-$color[cyan]} -prompt_colors[generic]=`print -Pn "%(! $PS1_ROOT $PS1_USER)"` - -normal_user && 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:-$prompt_colors[generic]} -fi -normal_user && if ( [ "$TERM" = "screen" ] ) -then - prompt_colors[generic]=${PS1_USER_SCR:-$prompt_colors[generic]} -fi # # This func is intended to give a quick way to set the colors for the @@ -46,6 +33,23 @@ fi # set_prompt_colors () { + prompt_colors[generic]=`print -Pn "%(! $PS1_ROOT $PS1_USER)"` + + if normal_user + then + 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:-$prompt_colors[generic]} + fi + if ( [ "$TERM" = "screen" ] ) + then + prompt_colors[generic]=${PS1_USER_SCR:-$prompt_colors[generic]} + fi + fi + local my_generic my_generic=${1:-$prompt_colors[generic]} prompt_colors[bold_generic]="$my_generic;$color[bold]" ## Always bold generic color diff --git a/12_Prompts.zsh b/12_Prompts.zsh index da36096..77aad63 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -8,6 +8,7 @@ ## these files with or without this notice. ## +prompt_colors[generic]=`print -Pn "%(! $PS1_ROOT $PS1_USER)"` set_prompt_colors $prompt_colors[generic] ## Prompts -- cgit v1.2.3 From 08f3029fe7b17c0bc85b766b2a2f605ccc54e71b Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 5 Feb 2009 15:40:35 +0100 Subject: [Colors] vlab prompt colors defaults to red, even under screen --- net:opera.openwide.fr/host:vlab/Environment.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/net:opera.openwide.fr/host:vlab/Environment.zsh b/net:opera.openwide.fr/host:vlab/Environment.zsh index 0e5fa92..f38d7da 100644 --- a/net:opera.openwide.fr/host:vlab/Environment.zsh +++ b/net:opera.openwide.fr/host:vlab/Environment.zsh @@ -1,2 +1,3 @@ PS1_USER=$color[red] PS1_USER_SSH=$PS1_USER +PS1_USER_SCR=$PS1_USER -- cgit v1.2.3 From af9c1de40bff87ae6ccc9430c364f7e18990dca8 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 5 Feb 2009 16:32:14 +0100 Subject: [Colors] better initialization of colors + sudo user color --- 11_Colors.zsh | 20 +------------------- 12_Prompts.zsh | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/11_Colors.zsh b/11_Colors.zsh index 3debc13..d50b4e5 100644 --- a/11_Colors.zsh +++ b/11_Colors.zsh @@ -24,6 +24,7 @@ typeset -A prompt_colors git_colors mail_colors correct_colors battery_colors da 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]} @@ -33,23 +34,6 @@ PS1_USER_SCR=${PS1_USER_SCR:-$color[cyan]} # set_prompt_colors () { - prompt_colors[generic]=`print -Pn "%(! $PS1_ROOT $PS1_USER)"` - - if normal_user - then - 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:-$prompt_colors[generic]} - fi - if ( [ "$TERM" = "screen" ] ) - then - prompt_colors[generic]=${PS1_USER_SCR:-$prompt_colors[generic]} - fi - fi - local my_generic my_generic=${1:-$prompt_colors[generic]} prompt_colors[bold_generic]="$my_generic;$color[bold]" ## Always bold generic color @@ -97,8 +81,6 @@ set_prompt_colors () git_colors[up_to_date]="$prompt_colors[up_to_date]" # git up-to-date } -set_prompt_colors - 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 77aad63..4151f32 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -8,8 +8,31 @@ ## these files with or without this notice. ## -prompt_colors[generic]=`print -Pn "%(! $PS1_ROOT $PS1_USER)"` -set_prompt_colors $prompt_colors[generic] +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 ( [ "$TERM" = "screen" ] ) + 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 +fi + +set_prompt_colors ## Prompts # -- cgit v1.2.3 From 7f345b27ba8bc859efc771188980138f127b3a93 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 5 Feb 2009 16:35:30 +0100 Subject: [Zlogin] don't stop other instances of keychain --- .zlogin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zlogin b/.zlogin index e5910e7..7e4c830 100644 --- a/.zlogin +++ b/.zlogin @@ -28,7 +28,7 @@ screen -list #cmd_exists remind && remind -n -cmd_exists keychain && eval $(keychain --eval --inherit any-once --stop others) +cmd_exists keychain && eval $(keychain --eval --inherit any-once --quick) #keychain id_dsa 593F1F92 chpwd -- cgit v1.2.3