From 6705ec98ca729e6b1bc8891ec9a1d6ba12d8823d Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Fri, 2 Dec 2011 08:36:38 -0500 Subject: [PATCH 1/8] Bad typo. set_theme $theme, not set_theme theme --- oh-my-zsh.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index d235e1fd4..76ebb83c6 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -46,4 +46,4 @@ done local theme zstyle -a :omz:style theme theme -set_theme theme +set_theme $theme From e7acbeada5e6e8094f68dd94b9aca45eab2a4c71 Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Fri, 2 Dec 2011 09:39:45 -0500 Subject: [PATCH 2/8] Attempt to install omz as a site function instead. --- oh-my-zsh.zsh => oh-my-zsh | 2 ++ templates/zshrc.arch-zsh-template | 9 --------- templates/zshrc.zsh-template | 30 ------------------------------ 3 files changed, 2 insertions(+), 39 deletions(-) rename oh-my-zsh.zsh => oh-my-zsh (98%) delete mode 100644 templates/zshrc.arch-zsh-template delete mode 100644 templates/zshrc.zsh-template diff --git a/oh-my-zsh.zsh b/oh-my-zsh similarity index 98% rename from oh-my-zsh.zsh rename to oh-my-zsh index 76ebb83c6..d7166a74e 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh @@ -1,4 +1,5 @@ # Initializes Oh My Zsh +oh-my-zsh() { ZSH=${ZSH:-/usr/share/oh-my-zsh} OMZ=${OMZ:-$HOME/.omz} @@ -47,3 +48,4 @@ done local theme zstyle -a :omz:style theme theme set_theme $theme +} diff --git a/templates/zshrc.arch-zsh-template b/templates/zshrc.arch-zsh-template deleted file mode 100644 index 09f51c8f7..000000000 --- a/templates/zshrc.arch-zsh-template +++ /dev/null @@ -1,9 +0,0 @@ -ZSH=/usr/share/oh-my-zsh - -zstyle :omz:style theme "arch-blue" - -plugins=(archlinux sprunge) - -omz_init() { - source $ZSH/oh-my-zsh.zsh -} diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template deleted file mode 100644 index bbec3a9d2..000000000 --- a/templates/zshrc.zsh-template +++ /dev/null @@ -1,30 +0,0 @@ -# Path to your oh-my-zsh configuration. -ZSH=$HOME/.oh-my-zsh - -# Set to this to use case-sensitive completion -# CASE_SENSITIVE="true" - -# Comment this out to disable weekly auto-update checks -# DISABLE_AUTO_UPDATE="true" - -# Uncomment following line if you want to disable colors in ls -# DISABLE_LS_COLORS="true" - -# Uncomment following line if you want to disable autosetting terminal title. -# DISABLE_AUTO_TITLE="true" - -# Uncomment following line if you want red dots to be displayed while waiting for completion -# COMPLETION_WAITING_DOTS="true" - -# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) -# Example format: plugins=(rails git textmate ruby lighthouse) -plugins=(git) - -source $ZSH/oh-my-zsh.zsh - -# Load a theme -# Look in $ZSH/themes/ -set_theme "robbyrussell" -# random_theme - -# Customize to your needs... From c974f24fb5c50f65e99f91423f39db72eb6e50b0 Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Fri, 2 Dec 2011 09:52:28 -0500 Subject: [PATCH 3/8] 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 From 88b2cd8ad100d838b14ced8af8879f1ad32f1168 Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Fri, 2 Dec 2011 09:53:12 -0500 Subject: [PATCH 4/8] Fix needs to be named the same as the function --- oh-my-zsh => omz | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename oh-my-zsh => omz (100%) diff --git a/oh-my-zsh b/omz similarity index 100% rename from oh-my-zsh rename to omz From af444231441dc2a07b9b7ed81b531a98c4a68a83 Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Fri, 2 Dec 2011 09:54:16 -0500 Subject: [PATCH 5/8] Opps, not start, should be init. --- omz | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omz b/omz index 19a89fdb3..9022d0c67 100644 --- a/omz +++ b/omz @@ -5,7 +5,7 @@ omz() { OMZ=${OMZ:-$HOME/.omz} case "$1" in - "start") + "init") local config_file plugin plugin=${plugin:=()} From 6363c6cbf0fc1030b5fcb619086370d4112c8ed3 Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Fri, 2 Dec 2011 11:00:25 -0500 Subject: [PATCH 6/8] We should start documenting things. --- README.md | 3 ++- plugins/archlinux/README.md | 0 plugins/git/README.md | 0 plugins/keychain/README.md | 0 plugins/notfound/README.md | 0 plugins/tmux/README.md | 34 ++++++++++++++++++++++++++++++++++ plugins/tmux/tmux.plugin.zsh | 18 +++++++++++++++++- 7 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 plugins/archlinux/README.md create mode 100644 plugins/git/README.md create mode 100644 plugins/keychain/README.md create mode 100644 plugins/notfound/README.md create mode 100644 plugins/tmux/README.md diff --git a/README.md b/README.md index 2db29c051..3c403b377 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,10 @@ $ chsh -s /bin/zsh Then the following needs to be added to `~/.zshrc` file to activate oh-my-zshell goodness. + autoload omz zstyle :omz:style theme arch-blue plugins=(archlinux sprunge git) - omz_init + omz init A skeleton template can be found at `/usr/share/oh-my-zsh/templates/user.zsh-template` diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/git/README.md b/plugins/git/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/keychain/README.md b/plugins/keychain/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/notfound/README.md b/plugins/notfound/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md new file mode 100644 index 000000000..6da3ef18c --- /dev/null +++ b/plugins/tmux/README.md @@ -0,0 +1,34 @@ +Tmux +==== + +DESCRIPTION TO GO HERE + +Configuration +------------- + +To set a corresponding command to a session name, set a zstyle like +this + + zstyle :omz:plugins:tmux:cmd irc weechat-curses + +This setups up the tmux plugin to start or jump to weechat when `t +irc` is executed. + +The plugin can be configured to start tmux with zsh. To do so, set +this zstyle appropriately. If so, it's ideal to have tmux first in the +plugin array + + zstyle :omz:plugins:tmux autostart on + +Usage +----- + +You can call the `t` function in two ways: + + t session + t session command + +Copyright & License +------------------- + +This plugin is released under the GLP3 diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index ce7e0d5b7..5e39f5792 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -1,9 +1,25 @@ +# tmux plugin +# Copyright (C) 2011 Simon Gomizelj +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# # Enable autostarting of tmux with: # zstyle :omz:plugins:tmux autostart on # # Configure t command to autostart a command like # this (example for "t irc"): -# zstyle :omz:plugins:cmd irc weechat-curses +# zstyle :omz:plugins:tmux:cmd irc weechat-curses # if (( $+commands[tmux] )); then From cf5be77c2e7d2b89dacb0f3cef28344efae57951 Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Fri, 2 Dec 2011 12:49:33 -0500 Subject: [PATCH 7/8] Load themes from ~/.omz/themes/ too --- lib/theming.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/theming.zsh b/lib/theming.zsh index 96d93cef2..b5921fcfd 100644 --- a/lib/theming.zsh +++ b/lib/theming.zsh @@ -1,10 +1,13 @@ set_theme() { - source "$ZSH/themes/$1.zsh-theme" + local theme + + theme=({$OMZ,$ZSH}/themes/$1-theme(N)) + source $theme[1] } random_theme() { local themes - themes=($ZSH/themes/*zsh-theme) + themes=($ZSH/themes/*zsh-theme(N)) source "$themes[$RANDOM%$#themes+1]" } From 15892d6e76ffb7a6a92d6cf574a8ae43a679d668 Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Fri, 2 Dec 2011 12:54:42 -0500 Subject: [PATCH 8/8] Try again. This works. --- lib/theming.zsh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/theming.zsh b/lib/theming.zsh index b5921fcfd..00d77f47b 100644 --- a/lib/theming.zsh +++ b/lib/theming.zsh @@ -1,14 +1,13 @@ set_theme() { - local theme - - theme=({$OMZ,$ZSH}/themes/$1-theme(N)) - source $theme[1] + local themes + themes=({$OMZ,$ZSH}/themes/$1.zsh-theme(N)) + source $themes[1] } random_theme() { local themes - themes=($ZSH/themes/*zsh-theme(N)) - source "$themes[$RANDOM%$#themes+1]" + themes=({$OMZ,$ZSH}/themes/*.zsh-theme(N)) + source $themes[$RANDOM%$#themes+1] } # compdef "_files -g '*.zsh'" set_theme