]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
zsh/rc: Underline hostname when running on a remote system.
authorSimon Ruderich <simon@ruderich.org>
Mon, 1 Apr 2013 21:24:25 +0000 (23:24 +0200)
committerSimon Ruderich <simon@ruderich.org>
Mon, 1 Apr 2013 21:24:25 +0000 (23:24 +0200)
Makes it very easy to spot what isn't running on a local machine.

zsh/rc

diff --git a/zsh/rc b/zsh/rc
index 8fb53670fc42b7dab255a3bb156f89154f7250d8..5889186973ea19dde4a1a92375611f976c478526 100644 (file)
--- a/zsh/rc
+++ b/zsh/rc
@@ -375,8 +375,13 @@ prompt_precmd() {
 
     # User name (%n) in bright green.
     local user="${green}%B%n%b${default}"
-    # Host name (%m) in bright green.
+    # Host name (%m) in bright green; underlined if running on a remote system
+    # through SSH.
     local host="${green}%B%m%b${default}"
+    if [[ -n $SSH_CONNECTION ]]; then
+        host="%U${host}%u"
+    fi
+
     # Number of background processes in yellow.
     local background="%(1j.${yellow}%j${default}.)"
     # Exit code in bright red if not zero.