From c974f24fb5c50f65e99f91423f39db72eb6e50b0 Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Fri, 2 Dec 2011 09:52:28 -0500 Subject: [PATCH] This should be interesting. --- oh-my-zsh | 90 ++++++++++++++++++++----------------- templates/user.zsh-template | 4 +- 2 files changed, 53 insertions(+), 41 deletions(-) diff --git a/oh-my-zsh b/oh-my-zsh index d7166a74e..19a89fdb3 100644 --- a/oh-my-zsh +++ b/oh-my-zsh @@ -1,51 +1,61 @@ -# Initializes Oh My Zsh -oh-my-zsh() { -ZSH=${ZSH:-/usr/share/oh-my-zsh} -OMZ=${OMZ:-$HOME/.omz} +# omz control center -local config_file plugin -plugin=${plugin:=()} +omz() { + ZSH=${ZSH:-/usr/share/oh-my-zsh} + OMZ=${OMZ:-$HOME/.omz} -# add a function path -fpath=($ZSH/functions $ZSH/completions $fpath) + case "$1" in + "start") + local config_file plugin + plugin=${plugin:=()} -if [[ -d $OMZ ]]; then - [[ -d $OMZ/functions ]] && fpath=($OMZ/functions $fpath) - [[ -d $OMZ/completion ]] && fpath=($OMZ/completions $fpath) -fi + # add a function path + fpath=($ZSH/functions $ZSH/completions $fpath) -for config_file ($ZSH/lib/*.zsh(N)) - source $config_file + if [[ -d $OMZ ]]; then + [[ -d $OMZ/functions ]] && fpath=($OMZ/functions $fpath) + [[ -d $OMZ/completion ]] && fpath=($OMZ/completions $fpath) + fi -if [[ -d $OMZ ]]; then - for config_file ($OMZ/*.zsh(N)) - source $config_file -fi + for config_file ($ZSH/lib/*.zsh(N)) + source $config_file -for plugin ($plugins) - fpath=($ZSH/plugins/$plugin $fpath) + if [[ -d $OMZ ]]; then + for config_file ($OMZ/*.zsh(N)) + source $config_file + fi -if [[ -d $OMZ ]]; then - if [[ -d $OMZ/plugins ]]; then - for plugin ($plugins) - fpath=($OMZ/plugins/$plugin $fpath) - fi -fi + for plugin ($plugins) + fpath=($ZSH/plugins/$plugin $fpath) -# Load and run compinit -autoload -U compinit -compinit -i + if [[ -d $OMZ ]]; then + if [[ -d $OMZ/plugins ]]; then + for plugin ($plugins) + fpath=($OMZ/plugins/$plugin $fpath) + fi + fi -# load plugins -for plugin ($plugins); do - if [[ -f $OMZ/plugins/$plugin/$plugin.plugin.zsh ]]; then - source $OMZ/plugins/$plugin/$plugin.plugin.zsh - elif [[ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]]; then - source $ZSH/plugins/$plugin/$plugin.plugin.zsh - fi -done + # Load and run compinit + autoload -U compinit + compinit -i -local theme -zstyle -a :omz:style theme theme -set_theme $theme + # load plugins + for plugin ($plugins); do + if [[ -f $OMZ/plugins/$plugin/$plugin.plugin.zsh ]]; then + source $OMZ/plugins/$plugin/$plugin.plugin.zsh + elif [[ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]]; then + source $ZSH/plugins/$plugin/$plugin.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 diff --git a/templates/user.zsh-template b/templates/user.zsh-template index 51f3df690..c387d2161 100644 --- a/templates/user.zsh-template +++ b/templates/user.zsh-template @@ -1,7 +1,9 @@ # Check /etc/zsh/zshrc for system defaults. +autoload omz + zstyle :omz:style theme "arch-blue" plugins=(archlinux sprunge git github) -omz_init +omz init