summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTharre <tharre3@gmail.com>2017-06-23 18:00:41 +0200
committerTharre <tharre3@gmail.com>2017-06-23 18:00:41 +0200
commit15dfac43ebedf7664402dd8e248756f929ce705d (patch)
tree072493ec964f4cd0c038e4a70ea03a6951a083f7
parent74425baa8a3ae08cac334c1c24f0516d056b94ec (diff)
downloaddotfiles-15dfac43ebedf7664402dd8e248756f929ce705d.tar.gz
dotfiles-15dfac43ebedf7664402dd8e248756f929ce705d.tar.xz
dotfiles-15dfac43ebedf7664402dd8e248756f929ce705d.zip
zsh-theme: prefix hostname when using ssh
Note this probably fails when you `sudo -s` while being connected over ssh, because it relies on environment variables. This should be fixed at a later time.
-rw-r--r--zsh-custom/themes/custom.zsh-theme8
1 files changed, 7 insertions, 1 deletions
diff --git a/zsh-custom/themes/custom.zsh-theme b/zsh-custom/themes/custom.zsh-theme
index ece45fe..b2c3b76 100644
--- a/zsh-custom/themes/custom.zsh-theme
+++ b/zsh-custom/themes/custom.zsh-theme
@@ -3,8 +3,14 @@
local return_code="%(?..%{$fg[red]%}:%?%{$reset_color%})"
+# prefix hostname if ssh session was detected
+if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_CONNECTION" ] || [ -n "$SSH_TTY" ]; then
+ local hostname="$fg[red][%m]%{$reset_color%} "
+fi
+
# primary prompt
-PROMPT='$FG[032]%(8~"[..]/")%7~\
+PROMPT='$hostname\
+$FG[032]%(8~"[..]/")%7~\
$(git_prompt_info) \
$FG[105]%1(j.[%j] .)%(!.#.$)%{$reset_color%} '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'