From cbbbc6d673c6c968c20da08d755224286403ac79 Mon Sep 17 00:00:00 2001 From: Tom Swartz Date: Thu, 8 May 2014 10:50:18 -0400 Subject: [PATCH] Add notification if in a remote session ZSH will display [SSH] in the right prompt if connected to a remote session. This allows for easier discernment between local and remote sessions. --- .zshrc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.zshrc b/.zshrc index cf50a2b..f013fd8 100644 --- a/.zshrc +++ b/.zshrc @@ -48,8 +48,8 @@ zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' enable git svn precmd () { # if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { - zstyle ':vcs_info:*' formats "[%b%c%u]" - zstyle ':vcs_info:*' actionformats "[%b%c%u] %a" + zstyle ':vcs_info:*' formats " [%b%c%u]" + zstyle ':vcs_info:*' actionformats " [%b%c%u] %a" # } else { # zstyle ':vcs_info:*' formats "[%b%c%u]" # } @@ -60,6 +60,12 @@ precmd () { setopt prompt_subst PROMPT="┌──[%n@%m]──[%*] └─▶ %~:%# " -RPROMPT='${vcs_info_msg_0_}%(?..%{$fg[red]%} [Error: %?]%{$reset_color%})%f' + +# Notify if in SSH session +if [[ -z "$SSH_CLIENT" ]]; then + RPROMPT='${vcs_info_msg_0_}%(?..%{$fg[red]%} [Error: %?]%{$reset_color%})%f' +else + RPROMPT='%{$fg_bold[blue]%}[SSH]%{$reset_color%}${vcs_info_msg_0_}%(?..%{$fg[red]%} [Error: %?]%{$reset_color%})%f' +fi archey3