summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Thoumie <flz@xbsd.org>2013-01-30 05:16:26 -0800
committerFlorent Thoumie <flz@xbsd.org>2013-01-30 05:16:26 -0800
commit6d762fa053154a10befec1a42c963fff072ebece (patch)
tree8ffc68a0316d04b822eecd6ed675c9a6421869df
parent615e41b0ecdb25acba513fd09619bd56c2eb24eb (diff)
downloadzsh-6d762fa053154a10befec1a42c963fff072ebece.tar.gz
zsh-6d762fa053154a10befec1a42c963fff072ebece.tar.bz2
zsh-6d762fa053154a10befec1a42c963fff072ebece.zip
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.
-rw-r--r--plugins/profiles/profiles.plugin.zsh12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/profiles/profiles.plugin.zsh b/plugins/profiles/profiles.plugin.zsh
new file mode 100644
index 000000000..8faae6b53
--- /dev/null
+++ b/plugins/profiles/profiles.plugin.zsh
@@ -0,0 +1,12 @@
+# You will probably want to list this plugin as the first in your .zshrc.
+
+# This will look for a custom profile for the local machine and each domain or
+# subdomain it belongs to. (e.g. com, example.com and foo.example.com)
+parts=(${(s:.:)$(hostname)})
+for i in {${#parts}..1}; do
+ profile=${(j:.:)${parts[$i,${#parts}]}}
+ file=$ZSH_CUSTOM/profiles/$profile
+ if [ -f $file ]; then
+ source $file
+ fi
+done