summaryrefslogtreecommitdiff
path: root/zsh
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2017-12-20 20:02:20 +0100
committerPatrick Simianer <p@simianer.de>2017-12-20 20:02:20 +0100
commitea6826594accd4006b82d9e6e95b329101afb257 (patch)
tree357a4bfa037f7d1957b0305876ed855270da6318 /zsh
parentb72cfbbfebea3e8f8ed71b04157deb905f7b746a (diff)
zsh: in_google_cloud
Diffstat (limited to 'zsh')
-rw-r--r--zsh/.zshrc21
1 files changed, 16 insertions, 5 deletions
diff --git a/zsh/.zshrc b/zsh/.zshrc
index ece46ac..b127914 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -91,6 +91,15 @@ stty -ixon # enable mapping of C-s in vim..
autoload -U colors && colors
+in_google_cloud () {
+ curl metadata.google.internal -i &>/dev/null
+ if [[ $? -eq 0 ]]; then
+ echo "yes"
+ else
+ echo "no"
+ fi
+}
+
# possible colors: black, white, green, cyan, red, yellow, magenta
case `hostname` in
bogues*|curry*|iverson*|jordan*|ming*|nowitzki*|oneal*|robinson*)
@@ -101,11 +110,7 @@ case `hostname` in
HOSTCOLOR_BG=blue
HOSTCOLOR_FG=black
;;
- ip-*)
- HOSTCOLOR_BG=cyan
- HOSTCOLOR_FG=black
- ;;
- 2pac|coltrane|donna|vicious|lemmy|CLuster|node*|gpu*)
+ 2pac|coltrane|donna|vicious|lemmy|CLuster)
HOSTCOLOR_BG=green
HOSTCOLOR_FG=black
;;
@@ -115,6 +120,12 @@ case `hostname` in
;;
esac
+# google cloud
+if [[ $(in_google_cloud) == "yes" ]]; then
+ HOSTCOLOR_BG=cyan
+ HOSTCOLOR_FG=white
+fi
+
function chpwd
{
if [[ -e $ZDIR/functions ]] {