]> git.rmz.io Git - dotfiles.git/blob - zsh/oh-my-zsh.sh
merge oh-my-zsh into subdir
[dotfiles.git] / zsh / oh-my-zsh.sh
1 # Check for updates on initial load...
2 if [ "$DISABLE_AUTO_UPDATE" != "true" ]
3 then
4 /usr/bin/env ZSH=$ZSH zsh $ZSH/tools/check_for_upgrade.sh
5 fi
6
7 # Initializes Oh My Zsh
8
9 # add a function path
10 fpath=($ZSH/functions $ZSH/completions $fpath)
11
12 # Load all of the config files in ~/oh-my-zsh that end in .zsh
13 # TIP: Add files you don't want in git to .gitignore
14 for config_file ($ZSH/lib/*.zsh); do
15 source $config_file
16 done
17
18 # Set ZSH_CUSTOM to the path where your custom config files
19 # and plugins exists, or else we will use the default custom/
20 if [[ -z "$ZSH_CUSTOM" ]]; then
21 ZSH_CUSTOM="$ZSH/custom"
22 fi
23
24
25 is_plugin() {
26 local base_dir=$1
27 local name=$2
28 test -f $base_dir/plugins/$name/$name.plugin.zsh \
29 || test -f $base_dir/plugins/$name/_$name
30 }
31 # Add all defined plugins to fpath. This must be done
32 # before running compinit.
33 for plugin ($plugins); do
34 if is_plugin $ZSH_CUSTOM $plugin; then
35 fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
36 elif is_plugin $ZSH $plugin; then
37 fpath=($ZSH/plugins/$plugin $fpath)
38 fi
39 done
40
41 # Load and run compinit
42 autoload -U compinit
43 compinit -i
44
45
46 # Load all of the plugins that were defined in ~/.zshrc
47 for plugin ($plugins); do
48 if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
49 source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh
50 elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
51 source $ZSH/plugins/$plugin/$plugin.plugin.zsh
52 fi
53 done
54
55 # Load all of your custom configurations from custom/
56 for config_file ($ZSH_CUSTOM/*.zsh(N)); do
57 source $config_file
58 done
59
60 # Load the theme
61 if [ "$ZSH_THEME" = "random" ]
62 then
63 themes=($ZSH/themes/*zsh-theme)
64 N=${#themes[@]}
65 ((N=(RANDOM%N)+1))
66 RANDOM_THEME=${themes[$N]}
67 source "$RANDOM_THEME"
68 echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
69 else
70 if [ ! "$ZSH_THEME" = "" ]
71 then
72 if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]
73 then
74 source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
75 else
76 source "$ZSH/themes/$ZSH_THEME.zsh-theme"
77 fi
78 fi
79 fi