mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
68 lines
1.7 KiB
Bash
68 lines
1.7 KiB
Bash
# omz control center
|
|
|
|
omz() {
|
|
ZSH=${ZSH:-/usr/share/oh-my-zsh}
|
|
OMZ=${OMZ:-$HOME/.omz}
|
|
|
|
case "$1" in
|
|
"init")
|
|
local config_file plugin
|
|
plugin=${plugin:=()}
|
|
|
|
# add a function path
|
|
fpath=($ZSH/functions $ZSH/completions $fpath)
|
|
|
|
if [[ -d $OMZ ]]; then
|
|
[[ -d $OMZ/functions ]] && fpath=($OMZ/functions $fpath)
|
|
[[ -d $OMZ/completion ]] && fpath=($OMZ/completions $fpath)
|
|
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
|
|
autoload -U compinit
|
|
compinit -i
|
|
|
|
# load plugins (TODO: Make this slimmer and better)
|
|
# for plugin ($fpath/*.plugin.zsh(N)) source $plugin
|
|
for plugin ($plugins); do
|
|
plugin_sub=$(basename $plugin)
|
|
if [[ -f $OMZ/plugins/$plugin/$plugin_sub.plugin.zsh ]]; then
|
|
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
|
|
|
|
local theme
|
|
zstyle -a :omz:style theme theme
|
|
set_theme $theme
|
|
;;
|
|
*)
|
|
echo "$0: invalid command $1" 2>&1
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# vi: ft=zsh
|