From 39ef31cfcfa84cce07a4c2e105e2e59d2ebed1cc Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 30 Jul 2014 01:04:54 -0400 Subject: [PATCH] Zsh: Show hostname if SSH session --- zsh/themes/prompt_my_setup | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zsh/themes/prompt_my_setup b/zsh/themes/prompt_my_setup index 7f923e4c..a7b24165 100644 --- a/zsh/themes/prompt_my_setup +++ b/zsh/themes/prompt_my_setup @@ -5,6 +5,12 @@ # Load dependencies. pmodload 'helper' +# Show the hostname if this is an SSH session +_prompt_my_host="" +if [ ! -z "$SSH_CLIENT" ]; then + _prompt_my_host=" %B%F{blue}| $(hostname | sed -e 's/\.local$//')%f%b" +fi + function prompt_my_pwd { local pwd="${PWD/#$HOME/~}" @@ -68,7 +74,7 @@ function prompt_my_setup { # Define prompts. PROMPT=' %F{cyan}${_prompt_my_pwd}%f${git_info:+${(e)git_info[prompt]}}%(!. %B%F{red}#%f%b.)${editor_info[keymap]} ' - RPROMPT='${editor_info[overwrite]}%(?:: %F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${git_info[rprompt]}' + RPROMPT='${editor_info[overwrite]}%(?:: %F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${git_info[rprompt]}${_prompt_my_host}' # SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' }