d2fe03d7549558745f999865ea0e348cb44e818f

Author
Christian Höltje <choltje@us.ibm.com>
Committer
Christian Höltje <choltje@us.ibm.com>
Date

Message

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.

Diff

 1diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
 2index 93c10e3d2e92ee111258a45d58aed8848ca13991..15c1dce44c19249a12823c5493226edc61358ce0 100644
 3--- a/oh-my-zsh.sh
 4+++ b/oh-my-zsh.sh
 5@@ -38,10 +38,20 @@ for plugin ($plugins); do
 6   fi
 7 done
 8 
 9+# Figure out the SHORT hostname
10+if [ -n "$commands[scutil]" ]; then
11+  # OS X
12+  SHORT_HOST=$(scutil --get ComputerName)
13+else
14+  SHORT_HOST=${HOST/.*/}
15+fi
16+
17+# Save the location of the current completion dump file.
18+ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
19+
20 # Load and run compinit
21 autoload -U compinit
22-compinit -i
23-
24+compinit -i -d "${ZSH_COMPDUMP}"
25 
26 # Load all of the plugins that were defined in ~/.zshrc
27 for plugin ($plugins); do