Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/robbyrussell/oh-my-zsh into…
Browse files Browse the repository at this point in the history
… taskwarrior-plugin
  • Loading branch information
lepht committed May 29, 2011
2 parents 1e86678 + 142c03d commit 8411a39
Show file tree
Hide file tree
Showing 31 changed files with 598 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,6 +2,7 @@ locals.zsh
log/.zsh_history
projects.zsh
custom/*
!custom/example
!custom/example.zsh
cache
*.swp
6 changes: 4 additions & 2 deletions README.textile
Expand Up @@ -48,7 +48,9 @@ the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty fo
h3. Customization

If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory.
If you have many functions which go good together you can put them as a *.plugin.zsh file in the @plugin/@ directory and then enable this plugin.
If you have many functions which go good together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin.
If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@.


h3. Uninstalling

Expand All @@ -68,4 +70,4 @@ This project wouldn't exist without all of our awesome users and contributors.

* "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors

Thank you so much!
Thank you so much!
2 changes: 2 additions & 0 deletions custom/example/example.plugin.zsh
@@ -0,0 +1,2 @@
# Add your own custom plugins in the custom/plugins directory. Plugins placed
# here will override ones with the same name in the main plugins directory.
2 changes: 1 addition & 1 deletion lib/functions.zsh
Expand Up @@ -29,7 +29,7 @@ function extract() {
*.tar.xz) tar xvJf $1;;
*.tar.lzma) tar --lzma -xvf $1;;
*.bz2) bunzip $1;;
*.rar) unrar $1;;
*.rar) unrar x $1;;
*.gz) gunzip $1;;
*.tar) tar xvf $1;;
*.tbz2) tar xvjf $1;;
Expand Down
8 changes: 5 additions & 3 deletions oh-my-zsh.sh
@@ -1,7 +1,7 @@
# Initializes Oh My Zsh

# add a function path
fpath=($ZSH/functions $fpath)
fpath=($ZSH/functions $ZSH/completions $fpath)

# Load all of the config files in ~/oh-my-zsh that end in .zsh
# TIP: Add files you don't want in git to .gitignore
Expand All @@ -17,7 +17,9 @@ compinit -i

# Load all of the plugins that were defined in ~/.zshrc
for plugin ($plugins); do
if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
if [ -f $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh ]; then
source $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh
elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
source $ZSH/plugins/$plugin/$plugin.plugin.zsh
fi
done
Expand All @@ -31,7 +33,7 @@ if [ "$ZSH_THEME" = "random" ]
then
themes=($ZSH/themes/*zsh-theme)
N=${#themes[@]}
((N=RANDOM%N))
((N=(RANDOM%N)+1))
RANDOM_THEME=${themes[$N]}
source "$RANDOM_THEME"
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
Expand Down
26 changes: 26 additions & 0 deletions plugins/ant/ant.plugin.zsh
@@ -0,0 +1,26 @@
stat -f%m . > /dev/null 2>&1
if [ "$?" = 0 ]; then
stat_cmd=(stat -f%m)
else
stat_cmd=(stat -L --format=%y)
fi

_ant_does_target_list_need_generating () {
if [ ! -f .ant_targets ]; then return 0;
else
accurate=$($stat_cmd -f%m .ant_targets)
changed=$($stat_cmd -f%m build.xml)
return $(expr $accurate '>=' $changed)
fi
}

_ant () {
if [ -f build.xml ]; then
if _ant_does_target_list_need_generating; then
sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets
fi
compadd `cat .ant_targets`
fi
}

compdef _ant ant
3 changes: 3 additions & 0 deletions plugins/autojump/autojump.plugin.zsh
@@ -0,0 +1,3 @@
if [ -f `brew --prefix`/etc/autojump ]; then
. `brew --prefix`/etc/autojump
fi
24 changes: 17 additions & 7 deletions plugins/brew/_brew
Expand Up @@ -25,21 +25,27 @@ _1st_arguments=(
'link:link a formula'
'list:list files in a formula or not-installed formulae'
'log:git commit log for a formula'
'missing:check all installed formuale for missing dependencies.'
'outdated:list formulas for which a newer version is available'
'prune:remove dead links'
'remove:remove a formula'
'search:search for a formula (/regex/ or string)'
'server:start a local web app that lets you browse formulae (requires Sinatra)'
'unlink:unlink a formula'
'update:freshen up links'
'upgrade:upgrade outdated formulae'
'uses:show formulas which depend on a formula'
)

local expl
local -a formula installed_formulae
local -a formulae installed_formulae

_arguments \
'(-v --verbose)'{-v,--verbose}'[verbose]' \
'(-v)-v[verbose]' \
'(--cellar)--cellar[brew cellar]' \
'(--config)--config[brew configuration]' \
'(--env)--env[brew environment]' \
'(--repository)--repository[brew repository]' \
'(--version)--version[version information]' \
'(--prefix)--prefix[where brew lives on this system]' \
'(--cache)--cache[brew cache]' \
Expand All @@ -51,20 +57,24 @@ if (( CURRENT == 1 )); then
fi

case "$words[1]" in
list)
search|-S)
_arguments \
'(--macports)--macports[search the macports repository]' \
'(--fink)--fink[search the fink repository]' ;;
list|ls)
_arguments \
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
'(--versions)--versions[list all installed versions of a formula]' \
'1: :->forms' && return 0

if [[ "$state" == forms ]]; then
_brew_installed_formulae
_requested installed_formulae expl 'installed formulae' compadd -a installed_formulae
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
fi ;;
install|home|log|info|uses|cat|deps)
install|home|homepage|log|info|abv|uses|cat|deps|edit|options)
_brew_all_formulae
_wanted formulae expl 'all formulae' compadd -a formulae ;;
remove|edit|xo)
remove|rm|uninstall|unlink|cleanup|link|ln)
_brew_installed_formulae
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
esac

13 changes: 13 additions & 0 deletions plugins/brew/brew.plugin.zsh
@@ -0,0 +1,13 @@
# Move /usr/local/bin (path where brews are linked) to the front of the path
# This will allow us to override system binaries like ruby with our brews
# TODO: Do this in a more compatible way.
# What if someone doesn't have /usr/bin in their path?
export PATH=`echo $PATH | sed -e 's|/usr/local/bin||' -e 's|::|:|g'` # Remove /usr/local/bin
export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/bin:&|'` # Add it in front of /usr/bin
export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/sbin:&|'` # Add /usr/local/sbin

alias brews='brew list -1'

function brew-link-completion {
ln -s "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" "$ZSH/plugins/brew/_brew.official"
}
2 changes: 1 addition & 1 deletion plugins/cap/cap.plugin.zsh
Expand Up @@ -18,4 +18,4 @@ function _cap () {
fi
}

compctl -K _cap cap
compctl -K _cap cap
2 changes: 0 additions & 2 deletions plugins/compleat/compleat.plugin.zsh
Expand Up @@ -5,7 +5,6 @@
# VERSION: 1.0.0
# ------------------------------------------------------------------------------


if (( ${+commands[compleat]} )); then
local prefix="${commands[compleat]:h:h}"
local setup="${prefix}/share/compleat-1.0/compleat_setup"
Expand All @@ -19,4 +18,3 @@ if (( ${+commands[compleat]} )); then
source "$setup"
fi
fi

1 change: 0 additions & 1 deletion plugins/github/github.plugin.zsh
Expand Up @@ -4,4 +4,3 @@ if [ "$commands[(I)hub]" ]; then
# eval `hub alias -s zsh`
function git(){hub "$@"}
fi

26 changes: 26 additions & 0 deletions plugins/gpg-agent/gpg-agent.plugin.zsh
@@ -0,0 +1,26 @@
# Based on ssh-agent code

local GPG_ENV=$HOME/.gnupg/gpg-agent.env

function start_agent {
/usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV} > /dev/null
chmod 600 ${GPG_ENV}
. ${GPG_ENV} > /dev/null
}

# Source GPG agent settings, if applicable
if [ -f "${GPG_ENV}" ]; then
. ${GPG_ENV} > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep gpg-agent > /dev/null || {
start_agent;
}
else
start_agent;
fi

export GPG_AGENT_INFO
export SSH_AUTH_SOCK
export SSH_AGENT_PID

GPG_TTY=$(tty)
export GPG_TTY
8 changes: 8 additions & 0 deletions plugins/node/node.plugin.zsh
@@ -0,0 +1,8 @@
# This works if you installed node via homebrew.
export NODE_PATH="/usr/local/lib/node"

# Open the node api for your current version to the optional section.
# TODO: Make the section part easier to use.
function node-api {
open "http://nodejs.org/docs/$(node --version)/api/all.html#$1"
}
2 changes: 2 additions & 0 deletions plugins/npm/npm.plugin.zsh
@@ -0,0 +1,2 @@
# TODO: Don't do this in such a weird way.
export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/share/npm/bin:&|'`
6 changes: 6 additions & 0 deletions plugins/osx/osx.plugin.zsh
@@ -1,3 +1,9 @@
alias showfiles='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder'
alias hidefiles='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder'

# Recursively delete .DS_Store files
alias rm-dsstore="find . -name '*.DS_Store' -type f -delete"

function savepath() {
pwd > ~/.current_path~
}
Expand Down
1 change: 0 additions & 1 deletion plugins/phing/phing.plugin.zsh
Expand Up @@ -10,7 +10,6 @@ _phing_does_target_list_need_generating () {
_phing () {
if [ -f build.xml ]; then
if _phing_does_target_list_need_generating; then
echo "\nGenerating .phing_targets..." > /dev/stderr
phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets
fi
compadd `cat .phing_targets`
Expand Down
10 changes: 10 additions & 0 deletions plugins/pow/pow.plugin.zsh
@@ -0,0 +1,10 @@
# Thanks to Christopher Sexton
# https://gist.github.com/965032
function kapow {
touch ~/.pow/$1/tmp/restart.txt
if [ $? -eq 0 ]; then
echo "$fg[yellow]Pow restarting $1...$reset_color"
fi
}

compctl -W ~/.pow -/ kapow
4 changes: 3 additions & 1 deletion plugins/ruby/ruby.plugin.zsh
@@ -1,4 +1,6 @@
# TODO: Make this compatible with rvm.
# Run sudo gem on the system ruby, not the active ruby.
alias sgem='sudo gem'

# Find ruby file
alias rfind='find . -name *.rb | xargs grep -n'
alias rfind='find . -name *.rb | xargs grep -n'

0 comments on commit 8411a39

Please sign in to comment.