summaryrefslogtreecommitdiff
path: root/zshrc
blob: 53853520ba2b536a94692a5c81de4ee2566b4524 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Determine location of this file from the assumption that
# it is linked to ~/.zshrc. This is required to find the
# config files and plugins located relative to this file

# directory this file is in
CFG_DIR=$(dirname $(readlink -f ~/.zshrc)) 

for plugin in $CFG_DIR/plugins/*(N); do
  # add *.zsh if no *.plugin.zsh found
  local files=( $plugin/*.plugin.zsh(N) )
  if [ ${#files[@]} -eq 0 ]; then
    files=( $plugin/*.zsh(N) )
  fi
  
  for file in $files; source $file
  fpath=($fpath $plugin)
done

fpath=($CFG_DIR/functions $fpath)
for fn in $CFG_DIR/functions/*(.N); autoload $(basename $fn)

for conf in $CFG_DIR/conf.d/*(.N); do
  source "$conf"
done