diff options
Diffstat (limited to 'oh-my-zsh.sh')
-rw-r--r-- | oh-my-zsh.sh | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index d0e89f31b..6cc5ac630 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -8,11 +8,10 @@ fi # add a function path fpath=($ZSH/functions $ZSH/completions $fpath) -# Load all of the config files in ~/oh-my-zsh that end in .zsh -# TIP: Add files you don't want in git to .gitignore -for config_file ($ZSH/lib/*.zsh); do - source $config_file -done +# Load all stock functions (from $fpath files) called below. +autoload -U compaudit compinit + +: ${ZSH_DISABLE_COMPFIX:=true} # Set ZSH_CUSTOM to the path where your custom config files # and plugins exists, or else we will use the default custom/ @@ -20,6 +19,21 @@ if [[ -z "$ZSH_CUSTOM" ]]; then ZSH_CUSTOM="$ZSH/custom" fi +# Set ZSH_CACHE_DIR to the path where cache files should be created +# or else we will use the default cache/ +if [[ -z "$ZSH_CACHE_DIR" ]]; then + ZSH_CACHE_DIR="$ZSH/cache/" +fi + + +# Load all of the config files in ~/oh-my-zsh that end in .zsh +# TIP: Add files you don't want in git to .gitignore +for config_file ($ZSH/lib/*.zsh); do + custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}" + [ -f "${custom_config_file}" ] && config_file=${custom_config_file} + source $config_file +done + is_plugin() { local base_dir=$1 @@ -50,9 +64,18 @@ if [ -z "$ZSH_COMPDUMP" ]; then ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" fi -# Load and run compinit -autoload -U compinit -compinit -i -d "${ZSH_COMPDUMP}" +if [[ $ZSH_DISABLE_COMPFIX != true ]]; then + # If completion insecurities exist, warn the user without enabling completions. + if ! compaudit &>/dev/null; then + # This function resides in the "lib/compfix.zsh" script sourced above. + handle_completion_insecurities + # Else, enable and cache completions to the desired file. + else + compinit -d "${ZSH_COMPDUMP}" + fi +else + compinit -i -d "${ZSH_COMPDUMP}" +fi # Load all of the plugins that were defined in ~/.zshrc for plugin ($plugins); do |