From d2fe03d7549558745f999865ea0e348cb44e818f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ho=CC=88ltje?= Date: Fri, 17 May 2013 11:17:33 -0400 Subject: [PATCH] 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. --- oh-my-zsh.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 93c10e3d..15c1dce4 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