mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
42 lines
1.2 KiB
Bash
42 lines
1.2 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:=()} # Create plugins array if not already set.
|
|
|
|
# Add plugins to fpath
|
|
fpath=({$ZSH,$OMZ}/functions(N) {$ZSH,$OMZ}/completions(N) $fpath)
|
|
for plugin in $plugins; do
|
|
files=({$OMZ,$ZSH}/plugins/$plugin)
|
|
fpath=($files[1] $fpath)
|
|
done
|
|
|
|
# Load and run compinit
|
|
autoload -U compinit
|
|
compinit -i
|
|
|
|
# Load libraries
|
|
for config_file ({$ZSH/lib,$OMZ}/*.zsh(N))
|
|
source $config_file
|
|
|
|
omz plugin $plugins
|
|
omz theme ;;
|
|
# Load plugins, can be used to load a plugin during runtime.
|
|
("plugin") shift; local plugin files
|
|
for plugin in $@; do
|
|
files=({$OMZ,$ZSH}/plugins/$plugin/*.zsh(N))
|
|
[[ ${#files} -eq 0 ]] && omz_log_msg "$plugin: Plugin not found." && continue
|
|
source $files[1] || omz_log_msg "$plugin: Error, can't source plugin file."
|
|
done ;;
|
|
("theme") local theme
|
|
zstyle -a :omz:style theme theme
|
|
set_theme ${2:-$theme} ;;
|
|
("log") omzlog ;;
|
|
(*) echo "$0: invalid command $1" 2>&1 ;;
|
|
esac
|
|
}
|
|
|
|
# vi: ft=zsh sw=2 ts=2 et
|