summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorPete Clark <pete.clark@gmail.com>2011-05-29 18:51:32 -0400
committerPete Clark <pete.clark@gmail.com>2011-05-29 18:51:32 -0400
commit8411a39a869cd80474e3898f2fa4f204599b943a (patch)
treea77b33ce1d48249a405c8c9e66936351d00d637f /plugins
parent1e86678f9d3c8c979ff8d3c8b5aac19e9e611441 (diff)
parent142c03dbd223683fd2d99f878b68f0f075cf33fb (diff)
downloadzsh-8411a39a869cd80474e3898f2fa4f204599b943a.tar.gz
zsh-8411a39a869cd80474e3898f2fa4f204599b943a.tar.bz2
zsh-8411a39a869cd80474e3898f2fa4f204599b943a.zip
Merge branch 'master' of git://github.com/robbyrussell/oh-my-zsh into taskwarrior-plugin
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ant/ant.plugin.zsh26
-rw-r--r--plugins/autojump/autojump.plugin.zsh3
-rw-r--r--plugins/brew/_brew24
-rw-r--r--plugins/brew/brew.plugin.zsh13
-rw-r--r--plugins/cap/cap.plugin.zsh2
-rw-r--r--plugins/compleat/compleat.plugin.zsh2
-rw-r--r--plugins/github/github.plugin.zsh1
-rw-r--r--plugins/gpg-agent/gpg-agent.plugin.zsh26
-rw-r--r--plugins/node/node.plugin.zsh8
-rw-r--r--plugins/npm/npm.plugin.zsh2
-rw-r--r--plugins/osx/osx.plugin.zsh6
-rw-r--r--plugins/phing/phing.plugin.zsh1
-rw-r--r--plugins/pow/pow.plugin.zsh10
-rw-r--r--plugins/ruby/ruby.plugin.zsh4
-rw-r--r--plugins/rvm/_rvm147
-rw-r--r--plugins/rvm/rvm.plugin.zsh52
-rw-r--r--plugins/textmate/textmate.plugin.zsh12
-rw-r--r--plugins/thor/_thor4
18 files changed, 323 insertions, 20 deletions
diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh
new file mode 100644
index 000000000..23bc7756a
--- /dev/null
+++ b/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
diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
new file mode 100644
index 000000000..da0a12765
--- /dev/null
+++ b/plugins/autojump/autojump.plugin.zsh
@@ -0,0 +1,3 @@
+if [ -f `brew --prefix`/etc/autojump ]; then
+ . `brew --prefix`/etc/autojump
+fi
diff --git a/plugins/brew/_brew b/plugins/brew/_brew
index cee1e25f0..1dcf0a4bf 100644
--- a/plugins/brew/_brew
+++ b/plugins/brew/_brew
@@ -25,10 +25,12 @@ _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'
@@ -36,10 +38,14 @@ _1st_arguments=(
)
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]' \
@@ -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
-
diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh
new file mode 100644
index 000000000..f584a4684
--- /dev/null
+++ b/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"
+}
diff --git a/plugins/cap/cap.plugin.zsh b/plugins/cap/cap.plugin.zsh
index a0fa21d00..8336182d5 100644
--- a/plugins/cap/cap.plugin.zsh
+++ b/plugins/cap/cap.plugin.zsh
@@ -18,4 +18,4 @@ function _cap () {
fi
}
-compctl -K _cap cap \ No newline at end of file
+compctl -K _cap cap
diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/compleat.plugin.zsh
index 8d16a5687..38f1b396a 100644
--- a/plugins/compleat/compleat.plugin.zsh
+++ b/plugins/compleat/compleat.plugin.zsh
@@ -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"
@@ -19,4 +18,3 @@ if (( ${+commands[compleat]} )); then
source "$setup"
fi
fi
-
diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh
index df7053ba7..1eb338113 100644
--- a/plugins/github/github.plugin.zsh
+++ b/plugins/github/github.plugin.zsh
@@ -4,4 +4,3 @@ if [ "$commands[(I)hub]" ]; then
# eval `hub alias -s zsh`
function git(){hub "$@"}
fi
-
diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh
new file mode 100644
index 000000000..8cc71fd57
--- /dev/null
+++ b/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
diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh
new file mode 100644
index 000000000..18f35333c
--- /dev/null
+++ b/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"
+}
diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh
new file mode 100644
index 000000000..0b0a30e11
--- /dev/null
+++ b/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:&|'`
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
index 81eed5e92..a65ca642a 100644
--- a/plugins/osx/osx.plugin.zsh
+++ b/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~
}
diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh
index 80e334629..8f4adca08 100644
--- a/plugins/phing/phing.plugin.zsh
+++ b/plugins/phing/phing.plugin.zsh
@@ -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`
diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh
new file mode 100644
index 000000000..6b2a6f2be
--- /dev/null
+++ b/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
diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh
index 82bf5d49d..08ca9c601 100644
--- a/plugins/ruby/ruby.plugin.zsh
+++ b/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' \ No newline at end of file
+alias rfind='find . -name *.rb | xargs grep -n'
diff --git a/plugins/rvm/_rvm b/plugins/rvm/_rvm
new file mode 100644
index 000000000..bba5304a0
--- /dev/null
+++ b/plugins/rvm/_rvm
@@ -0,0 +1,147 @@
+#compdef rvm
+
+local curcontext="$curcontext" state line cmds ret=1
+
+_arguments -C \
+ '(- 1 *)'{-v,--version}'[display version information]' \
+ '(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \
+ '(--prefix)--prefix[path for all rvm files (~/.rvm/), with trailing slash!]:path:_files' \
+ '(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \
+ '(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \
+ '(--archives)--archives[directory for downladed files (~/.rvm/archives/)]:path:_files' \
+ '-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \
+ '-e[Execute code from the command line]:code' \
+ '(-G)-G[root gem path to use]:path:_files' \
+ '(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \
+ '(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \
+ '(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \
+ '(-C|--configure)'{-C,--configure}'=[custom configure options]' \
+ '(--nice)--nice[process niceness (for slow computers, default 0)]:number' \
+ '(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \
+ '(--head)--head[with update, updates rvm to git head version]' \
+ '(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \
+ '(--default)--default[with ruby select, sets a default ruby for new shells]' \
+ '(--debug)--debug[Toggle debug mode on for very verbose output]' \
+ '(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \
+ '(--force)--force[Force install, removes old install & source before install]' \
+ '(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \
+ '(--latest)--latest[with gemset --dump skips version strings for latest gem]' \
+ '(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \
+ '(--docs)--docs[with install, attempt to generate ri after installation]' \
+ '(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \
+ '1: :->cmds' \
+ '*: :->args' && ret=0
+
+case $state in
+ cmds)
+ cmds=(
+ "version:show the rvm version installed in rvm_path"
+ "use:setup current shell to use a specific ruby version"
+ "reload:reload rvm source itself (useful after changing rvm source)"
+ "implode:(seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm)."
+ "update:upgrades rvm to the latest version."
+ "reset:remove current and stored default & system settings."
+ "info :show the *current* environment information for current ruby"
+ "current:print the *current* ruby version and the name of any gemset being used."
+ "debug:show info plus additional information for common issues"
+ "install:install one or many ruby versions"
+ "uninstall:uninstall one or many ruby versions, leaves their sources"
+ "remove:uninstall one or many ruby versions and remove their sources"
+ "migrate:Lets you migrate all gemsets from one ruby to another."
+ "upgrade:Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically."
+ "wrapper:generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like."
+ "cleanup:Lets you remove stale source folders / archives and other miscellaneous data associated with rvm."
+ "repair:Lets you repair parts of your environment e.g. wrappers, env files and and similar files (e.g. general maintenance)."
+ "snapshot:Lets your backup / restore an rvm installation in a lightweight manner."
+ "disk-usage:Tells you how much disk space rvm install is using."
+ "tools:Provides general information about the ruby environment, primarily useful when scripting rvm."
+ "docs:Tools to make installing ri and rdoc documentation easier."
+ "rvmrc:Tools related to managing rvmrc trust and loading."
+ "exec:runs an arbitrary command as a set operation."
+ "ruby:runs a named ruby file against specified and/or all rubies"
+ "gem:runs a gem command using selected ruby's 'gem'"
+ "rake:runs a rake task against specified and/or all rubies"
+ "tests:runs 'rake test' across selected ruby versions"
+ "specs:runs 'rake spec' across selected ruby versions"
+ "monitor:Monitor cwd for testing, run rake {spec,test} on changes."
+ "gemset:gemsets: http://rvm.beginrescueend.com/gemsets/"
+ "rubygems:Switches the installed version of rubygems for the current ruby."
+ "gemdir:display the path to the current gem directory (GEM_HOME)."
+ "srcdir:display the path to rvm source directory (may be yanked)"
+ "fetch:Performs an archive / src fetch only of the selected ruby."
+ "list:show currently installed rubies, interactive output."
+ "package:Install a dependency package {readline,iconv,zlib,openssl}"
+ "notes:Display notes, with operating system specifics."
+ "export:Temporarily set an environment variable in the current shell."
+ "unexport:Undo changes made to the environment by 'rvm export'."
+ )
+ _describe -t commands 'rvm command' cmds && ret=0
+ ;;
+ args)
+ case $line[1] in
+ (use|uninstall|remove|list)
+ _values -S , 'rubies' $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') default system && ret=0
+ ;;
+ (install|fetch)
+ _values -S , 'rubies' $(rvm list known_strings) && ret=0
+ ;;
+ gemset)
+ if (( CURRENT == 3 )); then
+ _values 'gemset_commands' \
+ 'import' \
+ 'export' \
+ 'create' \
+ 'copy' \
+ 'rename' \
+ 'empty' \
+ 'delete' \
+ 'name' \
+ 'dir' \
+ 'list' \
+ 'list_all' \
+ 'gemdir' \
+ 'install' \
+ 'pristine' \
+ 'clear' \
+ 'use' \
+ 'update' \
+ 'unpack' \
+ 'globalcache'
+ else
+ _values -S , 'gemsets' $(rvm gemset list | grep -v gemset 2>/dev/null)
+ fi
+ ret=0
+ ;;
+ package)
+ if (( CURRENT == 3 )); then
+ _values 'package_commands' \
+ 'install' \
+ 'uninstall'
+ else
+ _values 'packages' \
+ 'readline' \
+ 'iconv' \
+ 'curl' \
+ 'openssl' \
+ 'zlib' \
+ 'autoconf' \
+ 'ncurses' \
+ 'pkgconfig' \
+ 'gettext' \
+ 'glib' \
+ 'mono' \
+ 'llvm' \
+ 'libxml2' \
+ 'libxslt' \
+ 'libyaml'
+ fi
+ ret=0
+ ;;
+ *)
+ (( ret )) && _message 'no more arguments'
+ ;;
+ esac
+ ;;
+esac
+
+return ret
diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh
new file mode 100644
index 000000000..8a3ec788a
--- /dev/null
+++ b/plugins/rvm/rvm.plugin.zsh
@@ -0,0 +1,52 @@
+fpath=($ZSH/plugins/rvm $fpath)
+autoload -U compinit
+compinit -i
+
+alias rubies='rvm list rubies'
+alias gemsets='rvm gemset list'
+
+local ruby18='ruby-1.8.7-p334'
+local ruby19='ruby-1.9.2-p180'
+
+function rb18 {
+ if [ -z "$1" ]; then
+ rvm use "$ruby18"
+ else
+ rvm use "$ruby18@$1"
+ fi
+}
+
+_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`}
+compdef _rb18 rb18
+
+function rb19 {
+ if [ -z "$1" ]; then
+ rvm use "$ruby19"
+ else
+ rvm use "$ruby19@$1"
+ fi
+}
+
+_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
+compdef _rb19 rb19
+
+function rvm-update {
+ rvm get head
+ rvm reload # TODO: Reload rvm completion?
+}
+
+function rvm-link-completion {
+ ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official"
+}
+
+# TODO: Make this usable w/o rvm.
+function gems {
+ local current_ruby=`rvm-prompt i v p`
+ local current_gemset=`rvm-prompt g`
+
+ gem list $@ | sed \
+ -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
+ -Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
+ -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
+ -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
+}
diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh
index 7b73e2751..aa2f75f4f 100644
--- a/plugins/textmate/textmate.plugin.zsh
+++ b/plugins/textmate/textmate.plugin.zsh
@@ -1,11 +1,9 @@
+alias et='mate .'
+alias ett='mate app config lib db public spec test Rakefile Capfile Todo'
+alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
+alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
-# TextMate
-alias et='mate . &'
-alias ett='mate app config lib db public spec test Rakefile Capfile Todo &'
-alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
-alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
-
-# Editor Ruby file in TextMate
+# Edit Ruby app in TextMate
alias mr='mate CHANGELOG app config db lib public script spec test'
function tm() {
diff --git a/plugins/thor/_thor b/plugins/thor/_thor
new file mode 100644
index 000000000..9f7ed5aef
--- /dev/null
+++ b/plugins/thor/_thor
@@ -0,0 +1,4 @@
+#compdef thor
+#autoload
+
+compadd `thor list | grep thor | cut -d " " -f 2`