Significantly speed up startup time (1.2 seconds for me) by removing redundant compinit calls
| ... | ... |
@@ -7,12 +7,23 @@ fpath=($ZSH/functions $fpath) |
| 7 | 7 |
# TIP: Add files you don't want in git to .gitignore |
| 8 | 8 |
for config_file ($ZSH/lib/*.zsh) source $config_file |
| 9 | 9 |
|
| 10 |
-# Load all of your custom configurations from custom/ |
|
| 11 |
-for config_file ($ZSH/custom/*.zsh) source $config_file |
|
| 10 |
+# Add all defined plugins to fpath |
|
| 11 |
+plugin=${plugin:=()}
|
|
| 12 |
+for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) |
|
| 13 |
+ |
|
| 14 |
+# Load and run compinit |
|
| 15 |
+autoload -U compinit |
|
| 16 |
+compinit -i |
|
| 12 | 17 |
|
| 13 | 18 |
# Load all of the plugins that were defined in ~/.zshrc |
| 14 |
-plugin=${plugin:=()}
|
|
| 15 |
-for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh |
|
| 19 |
+for plugin ($plugins); do |
|
| 20 |
+ if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then |
|
| 21 |
+ source $ZSH/plugins/$plugin/$plugin.plugin.zsh |
|
| 22 |
+ fi |
|
| 23 |
+done |
|
| 24 |
+ |
|
| 25 |
+# Load all of your custom configurations from custom/ |
|
| 26 |
+for config_file ($ZSH/custom/*.zsh) source $config_file |
|
| 16 | 27 |
|
| 17 | 28 |
# Load the theme |
| 18 | 29 |
source "$ZSH/themes/$ZSH_THEME.zsh-theme" |