From 2be2733c1bdad6f7d4f238c200ff302cf4a7b73f Mon Sep 17 00:00:00 2001 From: Evan Pratten Date: Mon, 29 Aug 2022 11:13:02 -0400 Subject: [PATCH] Use colors to show remote connections --- configs/zsh/prompt.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/configs/zsh/prompt.sh b/configs/zsh/prompt.sh index cc37d83..62b6cec 100644 --- a/configs/zsh/prompt.sh +++ b/configs/zsh/prompt.sh @@ -4,7 +4,15 @@ autoload -U colors && colors NEWLINE=$'\n' -export PROMPT="%{$fg[green]%}%n@%M %{$fg[cyan]%}%~ $ %{$reset_color%}" + +# Use colors to signal local vs remote connections +if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + HOST_COLOR="yellow" +else + HOST_COLOR="green" +fi + +export PROMPT="%{$fg[$HOST_COLOR]%}%n@%M %{$fg[cyan]%}%~ $ %{$reset_color%}" setopt prompt_subst autoload -Uz vcs_info zstyle ':vcs_info:*' actionformats \