From 54e56b4067b1cadd280c2917ab2784a86e4a2b93 Mon Sep 17 00:00:00 2001 From: Starfall Date: Sat, 18 Jul 2020 22:01:20 -0500 Subject: zsh: hide @host part of prompt for local non-root user --- .config/zsh/.zshrc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- cgit