about summary refs log tree commit diff
path: root/.config
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2020-07-18 22:01:20 -0500
committerStarfall <us@starfall.systems>2020-07-22 14:36:08 -0500
commit54e56b4067b1cadd280c2917ab2784a86e4a2b93 (patch)
tree0f362819a3a8370b93dcc300aa7689cd05788209 /.config
parent75434ca6f326fbe1f74384c24b1bb74f7aca3de6 (diff)
zsh: hide @host part of prompt for local non-root user
Diffstat (limited to '.config')
-rw-r--r--.config/zsh/.zshrc7
1 files changed, 6 insertions, 1 deletions
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc
index 79cd4c9..2e73a3a 100644
--- a/.config/zsh/.zshrc
+++ b/.config/zsh/.zshrc
@@ -86,10 +86,15 @@ function spacetotab () {
 # TODO git integration was useful - port something from belak/zsh-utils or ohmyzsh
 # TODO location should control its length a little better
 # TODO only color the last segment of the path (pwd)
+user="%n"
+if [[ -n "$SSH_CLIENT" || "$USER" == "root" ]]; then
+	user+="@%M"
+fi
 last_status="%(?.%F{green}%#.%F{red}%?)%f"
 location="%F{blue}%3~%f"
-PROMPT="[%n@%m:$location] $last_status "
+PROMPT="[$user:$location] $last_status "
 RPROMPT="%!"
+unset user
 unset last_status
 unset location