summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Höltje <choltje@us.ibm.com>2013-05-17 11:17:33 -0400
committerChristian Höltje <choltje@us.ibm.com>2013-05-17 11:17:33 -0400
commitd2fe03d7549558745f999865ea0e348cb44e818f (patch)
tree907dee273ed5be23f3228b27b94b5ccaeda26439
parent27c6becffde091cc55e0df70875451ca82867935 (diff)
downloadzsh-d2fe03d7549558745f999865ea0e348cb44e818f.tar.gz
zsh-d2fe03d7549558745f999865ea0e348cb44e818f.tar.bz2
zsh-d2fe03d7549558745f999865ea0e348cb44e818f.zip
Create the zcompdump based on version and host
This will prevent lots of subtle problems that happen when people upgrade ZSH or use NFS mounted home directories. The ZSH_COMPDUMP variable can also be used to implement `zcompile` and other fun features in the future.
-rw-r--r--oh-my-zsh.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
index 93c10e3d2..15c1dce44 100644
--- a/oh-my-zsh.sh
+++ b/oh-my-zsh.sh
@@ -38,10 +38,20 @@ for plugin ($plugins); do
fi
done
+# Figure out the SHORT hostname
+if [ -n "$commands[scutil]" ]; then
+ # OS X
+ SHORT_HOST=$(scutil --get ComputerName)
+else
+ SHORT_HOST=${HOST/.*/}
+fi
+
+# Save the location of the current completion dump file.
+ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
+
# Load and run compinit
autoload -U compinit
-compinit -i
-
+compinit -i -d "${ZSH_COMPDUMP}"
# Load all of the plugins that were defined in ~/.zshrc
for plugin ($plugins); do