mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
re-wrote the omz controller, Improved the plugin management.
This commit is contained in:
parent
ad7c53598b
commit
82e7ddf686
1 changed files with 17 additions and 25 deletions
42
omz
42
omz
|
|
@ -1,19 +1,15 @@
|
||||||
# omz control center
|
# omz control center
|
||||||
|
|
||||||
omz() {
|
omz () {
|
||||||
ZSH=${ZSH:-/usr/share/oh-my-zsh}
|
ZSH=${ZSH:-/usr/share/oh-my-zsh}
|
||||||
OMZ=${OMZ:-$HOME/.omz}
|
OMZ=${OMZ:-$HOME/.omz}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"init")
|
("init") local config_file plugin
|
||||||
local config_file plugin
|
plugin=${plugin:=()} # Create plugins array if not already set.
|
||||||
plugin=${plugin:=()}
|
|
||||||
|
|
||||||
# add a function path
|
# Add plugins to fpath
|
||||||
fpath=({$ZSH,$OMZ}/functions(N) {$ZSH,$OMZ}/completions(N) $fpath)
|
fpath=({$ZSH,$OMZ}/functions(N) {$ZSH,$OMZ}/completions(N) $fpath)
|
||||||
|
for plugin in $plugins; do
|
||||||
# add plugins to fpath
|
|
||||||
for plugin ($plugins); do
|
|
||||||
files=({$OMZ,$ZSH}/plugins/$plugin)
|
files=({$OMZ,$ZSH}/plugins/$plugin)
|
||||||
fpath=($files[1] $fpath)
|
fpath=($files[1] $fpath)
|
||||||
done
|
done
|
||||||
|
|
@ -22,29 +18,25 @@ omz() {
|
||||||
autoload -U compinit
|
autoload -U compinit
|
||||||
compinit -i
|
compinit -i
|
||||||
|
|
||||||
# load lib
|
# Load libraries
|
||||||
for config_file ({$ZSH/lib,$OMZ}/*.zsh(N))
|
for config_file ({$ZSH/lib,$OMZ}/*.zsh(N))
|
||||||
source $config_file
|
source $config_file
|
||||||
|
|
||||||
|
# !next
|
||||||
omz plugin
|
omz plugin
|
||||||
omz theme
|
omz theme ;;
|
||||||
;;
|
# Load plugins, can be used to load a plugin during runtime.
|
||||||
"plugin")
|
("plugin") shift; local plugin files
|
||||||
# load plugins
|
for plugin in $plugins $@; do
|
||||||
for plugin ($plugins); do
|
|
||||||
files=({$OMZ,$ZSH}/plugins/$plugin/$(basename $plugin).plugin.zsh(N))
|
files=({$OMZ,$ZSH}/plugins/$plugin/$(basename $plugin).plugin.zsh(N))
|
||||||
[[ ${#files} -eq 0 ]] && continue
|
[[ ${#files} -eq 0 ]] && omz_log_msg "$plugin: Plugin not found." && continue
|
||||||
source $files[1] || omz_log_msg "$plugin: Error, can't source plugin file."
|
source $files[1] || omz_log_msg "$plugin: Error, can't source plugin file."
|
||||||
done
|
done ;;
|
||||||
;;
|
("theme") local theme
|
||||||
"theme")
|
|
||||||
local theme
|
|
||||||
zstyle -a :omz:style theme theme
|
zstyle -a :omz:style theme theme
|
||||||
set_theme ${2:-$theme}
|
set_theme ${2:-$theme} ;;
|
||||||
;;
|
("log") omzlog ;;
|
||||||
*)
|
(*) echo "$0: invalid command $1" 2>&1 ;;
|
||||||
echo "$0: invalid command $1" 2>&1
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue