a87e9c715b2d3249681f9cc8f8d9718030674d50

Author
Marc Cornellà <marc@mcornella.com>
Committer
Marc Cornellà <marc@mcornella.com>
Date

Message

fix(init): fix definition order for `$ZSH_CUSTOM`

Tipped about this in https://github.com/ohmyzsh/ohmyzsh/commit/6754b7e67#commitcomment-143280115

Diff

 1diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
 2index 9660f93c9adceb19a0eccf6607774ec4e1039215..694095afae7f192edf18171c59e5a04b6f60b01f 100644
 3--- a/oh-my-zsh.sh
 4+++ b/oh-my-zsh.sh
 5@@ -48,13 +48,15 @@ omz_f() {
 6 unset -f omz_f
 7 
 8 # If ZSH is not defined, use the current script's directory.
 9-[[ -z "$ZSH" ]] && export ZSH="${${(%):-%x}:a:h}"
10+[[ -n "$ZSH" ]] || export ZSH="${${(%):-%x}:a:h}"
11+
12+# Set ZSH_CUSTOM to the path where your custom config files
13+# and plugins exists, or else we will use the default custom/
14+[[ -n "$ZSH_CUSTOM" ]] || ZSH_CUSTOM="$ZSH/custom"
15 
16 # Set ZSH_CACHE_DIR to the path where cache files should be created
17 # or else we will use the default cache/
18-if [[ -z "$ZSH_CACHE_DIR" ]]; then
19-  ZSH_CACHE_DIR="$ZSH/cache"
20-fi
21+[[ -n "$ZSH_CACHE_DIR" ]] || ZSH_CACHE_DIR="$ZSH/cache"
22 
23 # Make sure $ZSH_CACHE_DIR is writable, otherwise use a directory in $HOME
24 if [[ ! -w "$ZSH_CACHE_DIR" ]]; then
25@@ -76,12 +78,6 @@ fpath=($ZSH/{functions,completions} $ZSH_CUSTOM/{functions,completions} $fpath)
26 # Load all stock functions (from $fpath files) called below.
27 autoload -U compaudit compinit zrecompile
28 
29-# Set ZSH_CUSTOM to the path where your custom config files
30-# and plugins exists, or else we will use the default custom/
31-if [[ -z "$ZSH_CUSTOM" ]]; then
32-    ZSH_CUSTOM="$ZSH/custom"
33-fi
34-
35 is_plugin() {
36   local base_dir=$1
37   local name=$2