6d762fa053154a10befec1a42c963fff072ebece

Author
Florent Thoumie <flz@xbsd.org>
Committer
Florent Thoumie <flz@xbsd.org>
Date

Message

Add new profiles plugin.

Depending on the machine you're logged into, you may want to use
specific configuration. Add 'profiles' to your list of plugin will
try to find a profile for the local machine and each (sub)domain
it belongs to.

Diff

 1diff --git a/plugins/profiles/profiles.plugin.zsh b/plugins/profiles/profiles.plugin.zsh
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..8faae6b53290b9fa9fb37255fb0159d142327df7
 4--- /dev/null
 5+++ b/plugins/profiles/profiles.plugin.zsh
 6@@ -0,0 +1,12 @@
 7+# You will probably want to list this plugin as the first in your .zshrc.
 8+
 9+# This will look for a custom profile for the local machine and each domain or
10+# subdomain it belongs to. (e.g. com, example.com and foo.example.com)
11+parts=(${(s:.:)$(hostname)})
12+for i in {${#parts}..1}; do
13+  profile=${(j:.:)${parts[$i,${#parts}]}}
14+  file=$ZSH_CUSTOM/profiles/$profile
15+  if [ -f $file ]; then
16+    source $file
17+  fi
18+done