From d36d57e62aa8237b08128c27abb08ed4de97f13c Mon Sep 17 00:00:00 2001 From: Matt Hamilton Date: Sat, 16 Apr 2016 14:56:46 -0700 Subject: [PATCH] [completion] add ${zcompdump_file} option This commit assumes that the user-provided variable for the filename will start with '.zcomp'. This is used in the .zlogin for zcompiling the completion file. Sourcing the .zimrc file within the .zlogin file is something I'd rather not do, and this seems like a good compromise. If this becomes an issue, the file can be sourced an the var can be used instead. Closes #42 --- modules/completion/init.zsh | 2 +- templates/zimrc | 8 ++++++++ templates/zlogin | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/completion/init.zsh b/modules/completion/init.zsh index 1d0a07e..1658946 100644 --- a/modules/completion/init.zsh +++ b/modules/completion/init.zsh @@ -16,7 +16,7 @@ fi fpath=(${0:h}/external/src ${fpath}) # load and initialize the completion system -autoload -Uz compinit && compinit -C -d ${ZDOTDIR:-${HOME}}/.zcompdump +autoload -Uz compinit && compinit -C -d "${ZDOTDIR:-${HOME}}/${zcompdump_file:-.zcompdump}" # set any compdefs source ${0:h}/compdefs.zsh diff --git a/templates/zimrc b/templates/zimrc index 482ef5e..7250fe8 100644 --- a/templates/zimrc +++ b/templates/zimrc @@ -24,6 +24,14 @@ zmodules=(directory environment git history input utility custom \ # Set your desired prompt here zprompt_theme='steeef' +# +# Completion +# + +# set an optional host-specific filename for the completion cache file +# if none is provided, the default '.zcompdump' is used. +#zcompdump_file=".zcompdump-${HOST}-${ZSH_VERSION}" + # # Utility # diff --git a/templates/zlogin b/templates/zlogin index 6243dc5..36b9e02 100644 --- a/templates/zlogin +++ b/templates/zlogin @@ -19,7 +19,9 @@ setopt EXTENDED_GLOB # zcompile the completion cache; siginificant speedup. - zcompare ${ZDOTDIR:-${HOME}}/.zcompdump + for file in ${ZDOTDIR:-${HOME}}/.zcomp^(*.zwc)(.); do + zcompare ${file} + done # zcompile .zshrc zcompare ${ZDOTDIR:-${HOME}}/.zshrc