diff options
author | Hugues Hiegel <hugues@hiegel.fr> | 2009-02-05 16:38:15 +0100 |
---|---|---|
committer | Hugues Hiegel <hugues@hiegel.fr> | 2009-02-05 16:38:15 +0100 |
commit | 893fba1b05b3639c622304db6ea8665916e5bb0b (patch) | |
tree | 1471735d4108c8c36effca76b4e4ea2685c608a4 | |
parent | a4579bc4f5cfe68d5b7a6d9ff1109a114958983c (diff) | |
parent | 7f345b27ba8bc859efc771188980138f127b3a93 (diff) |
Merge branch 'master' of ssh://82.245.101.89/git/zdotdir
-rw-r--r-- | .zlogin | 2 | ||||
-rw-r--r-- | 11_Colors.zsh | 16 | ||||
-rw-r--r-- | 12_Prompts.zsh | 26 | ||||
-rw-r--r-- | net:opera.openwide.fr/host:vlab/Environment.zsh | 1 |
4 files changed, 28 insertions, 17 deletions
@@ -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 diff --git a/11_Colors.zsh b/11_Colors.zsh index 00d405d..d50b4e5 100644 --- a/11_Colors.zsh +++ b/11_Colors.zsh @@ -24,21 +24,9 @@ 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]} -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 @@ -93,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 da36096..4151f32 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -8,7 +8,31 @@ ## these files with or without this notice. ## -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 # 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 |