2 ZSH=$XDG_CONFIG_HOME/zsh
 
   3 ZSH_DATA=$XDG_DATA_HOME/zsh
 
   4 ZSH_CACHE=$XDG_CACHE_HOME/zsh
 
   5 [[ ! -d "$ZSH" ]]       && echo "Missing config dir: '$ZSH'"      && return
 
   6 [[ ! -d "$ZSH_CACHE" ]] && echo "Missing cache dir: '$ZSH_CACHE'" && return
 
   7 [[ ! -d "$ZSH_DATA" ]]  && echo "Missing data dir: '$ZSH_DATA'"   && return
 
   9 # populate path (order matters)
 
  10 typeset -U path     # make path a unique array
 
  11 # osx gnu utils (installed via brew)
 
  12 if (( $+commands[brew] )); then
 
  13     for pkg in coreutils findutils gnu-sed make; do
 
  14         [[ -d $(brew --prefix $pkg)/libexec/gnubin ]] && path=($(brew --prefix $pkg)/libexec/gnubin $path)
 
  18 [[ -d ~/Library/Python/3.7/bin ]] && path=(~/Library/Python/3.7/bin $path)
 
  20 [[ -d ~/.local/bin ]] && path=(~/.local/bin $path)
 
  21 [[ -d ~/bin ]] && path=(~/bin $path)
 
  23 [[ -d /opt/android-sdk ]] && path=($path /opt/android-sdk/platform-tools)
 
  26 typeset -U fpath    # make fpath a unique array
 
  27 [[ -d $ZSH/functions ]] && fpath=($ZSH/functions $fpath)
 
  28 autoload -U ${fpath[1]}/*(:t)   # loads all functions in the first element of fpath
 
  30 # Load all of the config files in $ZSH/lib that end in .zsh
 
  31 for config_file ($ZSH/lib/*.zsh); do
 
  35 # Set name of the theme to load.
 
  38 [[ -f "$ZSH/themes/${ZSH_THEME}.zsh-theme" ]] && source "$ZSH/themes/${ZSH_THEME}.zsh-theme"
 
  40 # initialise completion
 
  41 autoload -U compinit; compinit -d "$ZSH_CACHE/zcompdump"
 
  43 # miscelaneous options
 
  45 setopt nonomatch    # if glob does not match, pass it to the command
 
  46 setopt numeric_glob_sort # sort numerically not lexically
 
  47 setopt noclobber    # don't allow overwriting files with '>', use '>!' instead
 
  49 setopt rcquotes     # echo 'don''t'; prints don't
 
  50 setopt dvorak       # correct_all uses dvorak
 
  51 setopt rematch_pcre # use perl regexp
 
  53 # disable flow control
 
  58 [[ -f $XDG_CONFIG_HOME/aliases ]] && source $XDG_CONFIG_HOME/aliases
 
  59 for alias_file ($ZSH/aliases/*.zsh); do
 
  63 # set up a few named directories
 
  64 hash -d fook=/mnt/fook
 
  68 hash -d evk=~/src/fpp/evk