This should be the bare minimum needed. Nothing bad will happen if a blank variable gets added to fpath or sourced. We don't need to check if its a file either since the globbing would already only return a file.

This commit is contained in:
Simon Gomizelj 2011-12-05 09:40:03 -05:00
commit 6b6a4216bf

49
omz
View file

@ -9,50 +9,25 @@ omz() {
local config_file plugin local config_file plugin
plugin=${plugin:=()} plugin=${plugin:=()}
# add a function path # add a function path
fpath=($ZSH/functions $ZSH/completions $fpath) fpath=({$ZSH,$OMZ}/functions(N) {$ZSH,$OMZ}/completions(N) $fpath)
if [[ -d $OMZ ]]; then # add plugins to fpath
[[ -d $OMZ/functions ]] && fpath=($OMZ/functions $fpath) for plugin ($plugins)
[[ -d $OMZ/completion ]] && fpath=($OMZ/completions $fpath) fpath=({$OMZ,$ZSH}/plugins/$plugin.plugin.zsh(N))
fi
for config_file ($ZSH/lib/*.zsh(N))
source $config_file
if [[ -d $OMZ ]]; then
for config_file ($OMZ/*.zsh(N))
source $config_file
fi
# for plugin ($plugins)
# fpath=($ZSH/plugins/$plugin $fpath)
# if [[ -d $OMZ ]]; then
# if [[ -d $OMZ/plugins ]]; then
# for plugin ($plugins)
# fpath=($OMZ/plugins/$plugin $fpath)
# fi
# fi
for plugin ($plugins); do
files=({$OMZ,$ZSH}/plugins/$plugin(N))
[[ -n $files[1] ]] && fpath=($files[1] $fpath) || omz_log_msg "$plugin not found."
done
# Load and run compinit # Load and run compinit
autoload -U compinit autoload -U compinit
compinit -i compinit -i
# load plugins (TODO: Make this slimmer and better) # load lib
# for plugin ($fpath/*.plugin.zsh(N)) source $plugin for config_file ({$ZSH/lib,$OMZ}/*.zsh(N))
source $config_file
# load plugins
for plugin ($plugins); do for plugin ($plugins); do
plugin_sub=$(basename $plugin) files=({$OMZ,$ZSH}/plugins/$plugin.plugin.zsh(N))
if [[ -f $OMZ/plugins/$plugin/$plugin_sub.plugin.zsh ]]; then source $files[1] || omz_log_msg "$plugin not found."
source $OMZ/plugins/$plugin/$plugin_sub.plugin.zsh
elif [[ -f $ZSH/plugins/$plugin/$plugin_sub.plugin.zsh ]]; then
source $ZSH/plugins/$plugin/$plugin_sub.plugin.zsh
fi
done done
local theme local theme