From 3c92269dcfea00569bfee79fadce50d98818ff35 Mon Sep 17 00:00:00 2001 From: Ayaz Badouraly <ayaz.badouraly@via.ecp.fr> Date: Sun, 29 May 2016 04:27:45 +0200 Subject: [PATCH] Splitting code --- via.zsh-theme | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/via.zsh-theme b/via.zsh-theme index 41e4ff6..9814e78 100644 --- a/via.zsh-theme +++ b/via.zsh-theme @@ -1,4 +1,23 @@ # VIA ZSH Theme - Preview: ASAP # Fork from the historical VIA ZSH Theme -PROMPT='%{$fg_bold[cyan]%}%T %{$fg_bold[red]%}%n%{$fg_bold[yellow]%}@%{$fg_bold[white]%}%m %{$fg_bold[green]%}%c%{$fg_bold[yellow]%}%% ' +local clock="%{$fg_bold[cyan]%}%T%{$reset_color%}" + +# Check the UID +if [[ $UID -ne 0 ]]; +then + # normal user + local user="%{$fg_bold[red]%}%n%{$reset_color%}" + local eol="%{$fg_bold[yellow]%}%%%{$reset_color%}" +else + # root + local user="%{$fg_bold[blue]%}%n%{$reset_color%}" + local eol="%{$fg_bold[yellow]%}#%{$reset_color%}" +fi + +local user_host="${user}%{$fg_bold[yellow]%}@%{$fg_bold[white]%}%m%{$reset_color%}" + +local current_dir="%{$fg_bold[green]%}%c%{$reset_color%}" + +PROMPT="${clock} ${user_host} ${current_dir}${eol} " + -- GitLab