new function to display path neatly
authorJoerg Jaspert <joerg@ganneff.de>
Wed, 27 Mar 2013 16:41:14 +0000 (17:41 +0100)
committerJoerg Jaspert <joerg@ganneff.de>
Wed, 27 Mar 2013 16:41:14 +0000 (17:41 +0100)
.zsh/functions/path [new file with mode: 0644]

diff --git a/.zsh/functions/path b/.zsh/functions/path
new file mode 100644 (file)
index 0000000..6d36fa4
--- /dev/null
@@ -0,0 +1,14 @@
+# -*- mode:sh -*-
+
+# From http://zanshin.net/2013/02/02/zsh-configuration-from-the-ground-up/
+# -------------------------------------------------------------------
+# display a neatly formatted path
+# -------------------------------------------------------------------
+
+echo $PATH | tr ":" "\n" | \
+    awk "{ sub(\"/usr\", \"$fg_no_bold[green]/usr$reset_color\"); \
+sub(\"/bin\", \"$fg_no_bold[blue]/bin$reset_color\"); \
+sub(\"/opt\", \"$fg_no_bold[cyan]/opt$reset_color\"); \
+sub(\"/sbin\", \"$fg_no_bold[magenta]/sbin$reset_color\"); \
+sub(\"/local\", \"$fg_no_bold[yellow]/local$reset_color\"); \
+print }"