Browse code

Merged pull request #269 from oknowton/master.

Significantly speed up startup time (1.2 seconds for me) by removing redundant compinit calls

Robby Russell authored on 29/04/2011 at 06:24:39
Showing 12 changed files
... ...
@@ -8,9 +8,6 @@ setopt always_to_end
8 8
 
9 9
 WORDCHARS=''
10 10
 
11
-autoload -U compinit
12
-compinit -i
13
-
14 11
 zmodload -i zsh/complist
15 12
 
16 13
 ## case-insensitive (all),partial-word and then substring completion
... ...
@@ -1,6 +1,4 @@
1 1
 # TODO: Explain what some of this does..
2
-autoload -U compinit
3
-compinit -i
4 2
 
5 3
 bindkey -e
6 4
 bindkey '\ew' kill-region
... ...
@@ -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"
19 30
deleted file mode 100644
... ...
@@ -1,4 +0,0 @@
1
-# add brew completion function to path
2
-fpath=($ZSH/plugins/brew $fpath)
3
-autoload -U compinit
4
-compinit -i
5 1
deleted file mode 100644
... ...
@@ -1,4 +0,0 @@
1
-# add cpanm completion function to path
2
-fpath=($ZSH/plugins/cpanm $fpath)
3
-autoload -U compinit
4
-compinit -i
5 1
deleted file mode 100644
... ...
@@ -1,4 +0,0 @@
1
-# add gem completion function to path
2
-fpath=($ZSH/plugins/gem $fpath)
3
-autoload -U compinit
4
-compinit -i
... ...
@@ -5,7 +5,3 @@ if [ "$commands[(I)hub]" ]; then
5 5
     function git(){hub "$@"}
6 6
 fi
7 7
 
8
-# add github completion function to path
9
-fpath=($ZSH/plugins/github $fpath)
10
-autoload -U compinit
11
-compinit -i
... ...
@@ -6,7 +6,3 @@ alias puni="sudo port uninstall inactive"
6 6
 alias puo="sudo port upgrade outdated"
7 7
 alias pup="psu && puo"
8 8
 
9
-# add macports completion function to path
10
-fpath=($ZSH/plugins/macports $fpath)
11
-autoload -U compinit
12
-compinit -i
13 9
deleted file mode 100644
... ...
@@ -1,4 +0,0 @@
1
-# add npm completion function to path
2
-fpath=($ZSH/plugins/npm $fpath)
3
-autoload -U compinit
4
-compinit -i
5 1
deleted file mode 100644
... ...
@@ -1,4 +0,0 @@
1
-# add brew completion function to path
2
-fpath=($ZSH/plugins/pip $fpath)
3
-autoload -U compinit
4
-compinit -i
5 1
deleted file mode 100644
... ...
@@ -1,4 +0,0 @@
1
-# add redis completion function to path
2
-fpath=($ZSH/plugins/redis-cli $fpath)
3
-autoload -U compinit
4
-compinit -i
5 1
deleted file mode 100644
... ...
@@ -1,3 +0,0 @@
1
-fpath=($ZSH/plugins/vagrant $fpath)
2
-autoload -U compinit
3
-compinit -i