From ad479d173fc2be4064c950091eee98343ca651a5 Mon Sep 17 00:00:00 2001
From: Ayaz Badouraly <ayaz.badouraly@via.ecp.fr>
Date: Mon, 19 Dec 2016 23:25:21 +0100
Subject: [PATCH] Using built-in ternary expression in context prompt

---
 via.zsh-theme | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/via.zsh-theme b/via.zsh-theme
index 799899c..fc16329 100644
--- a/via.zsh-theme
+++ b/via.zsh-theme
@@ -36,22 +36,14 @@ set_default OHMYVIA_VCS_THEME            "default"
 
 local clock="%B%F{cyan}$OHMYVIA_TIME_FORMAT%f%b"
 
-# Check the UID
-if [[ $UID -ne 0 ]];
-then
-	# normal user
-	local user="%B%F{red}%n%f%b"
-	local eol="%B%(?.%F{yellow}.%F{red})%%%f%b"
-else
-	# root
-	local user="%B%F{blue}%n%f%b"
-	local eol="%B%(?.%F{yellow}.%F{red})#%f%b"
-fi
+local user="%B%(!.%F{blue}.%F{red})%n%f%b"
 
 local user_host="${user}%B%F{yellow}@%F{white}%m%f%b"
 
 local current_dir="%B%F{green}%~%f%b"
 
+local eol="%B%(?.%F{yellow}.%F{red})%#%f%b"
+
 PROMPT='${clock} ${user_host} ${current_dir}${eol} '
 
 # Display vcs info
-- 
GitLab