summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/autojump/autojump.plugin.zsh4
-rw-r--r--plugins/bundler/_bundler82
-rw-r--r--plugins/bundler/bundler.plugin.zsh15
-rw-r--r--plugins/cake/cake.plugin.zsh22
-rw-r--r--plugins/deb/deb.plugin.zsh13
-rw-r--r--plugins/debian/debian.plugin.zsh133
-rw-r--r--plugins/git/git.plugin.zsh3
-rw-r--r--plugins/github/github.plugin.zsh60
-rw-r--r--plugins/gnu-utils/gnu-utils.plugin.zsh80
-rw-r--r--plugins/gradle/gradle.plugin.zsh119
-rwxr-xr-xplugins/grails/grails.plugin.zsh54
-rw-r--r--plugins/knife/_knife9
-rw-r--r--plugins/mercurial/mercurial.plugin.zsh14
-rw-r--r--plugins/npm/_npm19
-rw-r--r--plugins/npm/npm.plugin.zsh1
-rw-r--r--plugins/nyan/nyan.plugin.zsh5
-rw-r--r--plugins/pip/_pip64
-rw-r--r--plugins/python/python.plugin.zsh5
-rw-r--r--plugins/rails3/rails3.plugin.zsh2
-rw-r--r--plugins/sprunge/sprunge.plugin.zsh64
-rw-r--r--plugins/svn/svn.plugin.zsh8
-rw-r--r--plugins/symfony2/symfony2.plugin.zsh13
-rw-r--r--plugins/terminitor/_terminitor38
-rw-r--r--plugins/textmate/textmate.plugin.zsh2
-rw-r--r--plugins/vundle/vundle.plugin.zsh23
-rw-r--r--plugins/wakeonlan/README29
-rw-r--r--plugins/wakeonlan/_wake4
-rw-r--r--plugins/wakeonlan/wakeonlan.plugin.zsh14
28 files changed, 805 insertions, 94 deletions
diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
index da0a12765..6f9b80bff 100644
--- a/plugins/autojump/autojump.plugin.zsh
+++ b/plugins/autojump/autojump.plugin.zsh
@@ -1,3 +1,5 @@
-if [ -f `brew --prefix`/etc/autojump ]; then
+if [ -f /opt/local/etc/profile.d/autojump.sh ]; then
+ . /opt/local/etc/profile.d/autojump.sh
+elif [ -f `brew --prefix`/etc/autojump ]; then
. `brew --prefix`/etc/autojump
fi
diff --git a/plugins/bundler/_bundler b/plugins/bundler/_bundler
new file mode 100644
index 000000000..5d22cac9a
--- /dev/null
+++ b/plugins/bundler/_bundler
@@ -0,0 +1,82 @@
+#compdef bundle
+
+local curcontext="$curcontext" state line _gems _opts ret=1
+
+_arguments -C -A "-v" -A "--version" \
+ '(- 1 *)'{-v,--version}'[display version information]' \
+ '1: :->cmds' \
+ '*:: :->args' && ret=0
+
+case $state in
+ cmds)
+ _values "bundle command" \
+ "install[Install the gems specified by the Gemfile or Gemfile.lock]" \
+ "update[Update dependencies to their latest versions]" \
+ "package[Package the .gem files required by your application]" \
+ "exec[Execute a script in the context of the current bundle]" \
+ "config[Specify and read configuration options for bundler]" \
+ "check[Determine whether the requirements for your application are installed]" \
+ "list[Show all of the gems in the current bundle]" \
+ "show[Show the source location of a particular gem in the bundle]" \
+ "console[Start an IRB session in the context of the current bundle]" \
+ "open[Open an installed gem in the editor]" \
+ "viz[Generate a visual representation of your dependencies]" \
+ "init[Generate a simple Gemfile, placed in the current directory]" \
+ "gem[Create a simple gem, suitable for development with bundler]" \
+ "help[Describe available tasks or one specific task]"
+ ret=0
+ ;;
+ args)
+ case $line[1] in
+ help)
+ _values 'commands' \
+ 'install' \
+ 'update' \
+ 'package' \
+ 'exec' \
+ 'config' \
+ 'check' \
+ 'list' \
+ 'show' \
+ 'console' \
+ 'open' \
+ 'viz' \
+ 'init' \
+ 'gem' \
+ 'help' && ret=0
+ ;;
+ install)
+ _arguments \
+ '(--no-color)--no-color[disable colorization in output]' \
+ '(--local)--local[do not attempt to connect to rubygems.org]' \
+ '(--quiet)--quiet[only output warnings and errors]' \
+ '(--gemfile)--gemfile=-[use the specified gemfile instead of Gemfile]:gemfile' \
+ '(--system)--system[install to the system location]' \
+ '(--deployment)--deployment[install using defaults tuned for deployment environments]' \
+ '(--frozen)--frozen[do not allow the Gemfile.lock to be updated after this install]' \
+ '(--path)--path=-[specify a different path than the system default]:path:_files' \
+ '(--binstubs)--binstubs=-[generate bin stubs for bundled gems to ./bin]:directory:_files' \
+ '(--without)--without=-[exclude gems that are part of the specified named group]:groups'
+ ret=0
+ ;;
+ exec)
+ _normal && ret=0
+ ;;
+ (open|show)
+ _gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') )
+ if [[ $_gems != "" ]]; then
+ _values 'gems' $_gems && ret=0
+ fi
+ ;;
+ *)
+ _opts=( $(bundle help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') )
+ _opts+=( $(bundle help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') )
+ if [[ $_opts != "" ]]; then
+ _values 'options' $_opts && ret=0
+ fi
+ ;;
+ esac
+ ;;
+esac
+
+return ret
diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
index a6c116407..3c96b8da9 100644
--- a/plugins/bundler/bundler.plugin.zsh
+++ b/plugins/bundler/bundler.plugin.zsh
@@ -1,12 +1,16 @@
+fpath=($ZSH/plugins/bundler $fpath)
+autoload -U compinit
+compinit -i
+
alias be="bundle exec"
alias bi="bundle install"
alias bl="bundle list"
-alias bu="bundle update"
alias bp="bundle package"
+alias bu="bundle update"
# The following is based on https://github.com/gma/bundler-exec
-bundled_commands=(cap capify cucumber guard heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails)
+bundled_commands=(cap capify cucumber foreman guard heroku nanoc rackup rails rainbows rake rspec ruby shotgun spec spork thin unicorn unicorn_rails)
## Functions
@@ -33,5 +37,10 @@ _run-with-bundler() {
## Main program
for cmd in $bundled_commands; do
- alias $cmd="_run-with-bundler $cmd"
+ eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}"
+ alias $cmd=bundled_$cmd
+
+ if which _$cmd > /dev/null 2>&1; then
+ compdef _$cmd bundled_$cmd
+ fi
done
diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/cake.plugin.zsh
index f968c71d5..1d0d196ee 100644
--- a/plugins/cake/cake.plugin.zsh
+++ b/plugins/cake/cake.plugin.zsh
@@ -1,18 +1,22 @@
# Set this to 1 if you want to cache the tasks
-cache_task_list=1
+_cake_cache_task_list=1
# Cache filename
-cache_file='.cake_task_cache'
+_cake_task_cache_file='.cake_task_cache'
+
+_cake_get_target_list () {
+ cake | grep '^cake ' | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'
+}
_cake_does_target_list_need_generating () {
- if [ $cache_task_list -eq 0 ]; then
+ if [ ${_cake_cache_task_list} -eq 0 ]; then
return 1;
fi
- if [ ! -f $cache_file ]; then return 0;
+ if [ ! -f ${_cake_task_cache_file} ]; then return 0;
else
- accurate=$(stat -f%m $cache_file)
+ accurate=$(stat -f%m $_cake_task_cache_file)
changed=$(stat -f%m Cakefile)
return $(expr $accurate '>=' $changed)
fi
@@ -21,12 +25,12 @@ _cake_does_target_list_need_generating () {
_cake () {
if [ -f Cakefile ]; then
if _cake_does_target_list_need_generating; then
- cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$' > $cache_file
- compadd `cat $cache_file`
+ _cake_get_target_list > ${_cake_task_cache_file}
+ compadd `cat ${_cake_task_cache_file}`
else
- compadd `cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'`
+ compadd `_cake_get_target_list`
fi
fi
}
-compdef _cake cake
+compdef _cake cake \ No newline at end of file
diff --git a/plugins/deb/deb.plugin.zsh b/plugins/deb/deb.plugin.zsh
deleted file mode 100644
index 1b35a0646..000000000
--- a/plugins/deb/deb.plugin.zsh
+++ /dev/null
@@ -1,13 +0,0 @@
-# Aliases
-alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \
- --no-gui --disable-columns search" # search package
-alias ad="sudo apt-get update" # update packages lists
-alias au="sudo apt-get update && \
- sudo apt-get dselect-upgrade" # upgrade packages
-alias ai="sudo apt-get install" # install package
-alias ar="sudo apt-get remove --purge && \
- sudo apt-get autoremove --purge" # remove package
-alias ap="apt-cache policy" # apt policy
-alias av="apt-cache show" # show package info
-alias acs="apt-cache search" # search package
-alias ac="sudo apt-get clean && sudo apt-get autoclean" # clean apt cache
diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
index f8865a412..09771881d 100644
--- a/plugins/debian/debian.plugin.zsh
+++ b/plugins/debian/debian.plugin.zsh
@@ -1,53 +1,143 @@
-# https://github.com/dbbolton/
+# Authors:
+# https://github.com/AlexBio
+# https://github.com/dbb
#
# Debian-related zsh aliases and functions for zsh
+# Use aptitude if installed, or apt-get if not.
+# You can just set apt_pref='apt-get' to override it.
+if [[ -e $( which aptitude ) ]]; then
+ apt_pref='aptitude'
+else
+ apt_pref='apt-get'
+fi
+
+# Use sudo by default if it's installed
+if [[ -e $( which sudo ) ]]; then
+ use_sudo=1
+fi
# Aliases ###################################################################
+# These are for more obscure uses of apt-get and aptitude that aren't covered
+# below.
+alias ag='apt-get'
+alias at='aptitude'
# Some self-explanatory aliases
-alias afs='apt-file search --regexp'
+alias acs="apt-cache search"
alias aps='aptitude search'
-alias apsrc='apt-get source'
-alias apv='apt-cache policy'
+alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \
+ --no-gui --disable-columns search" # search package
-alias apdg='su -c "aptitude update && aptitude safe-upgrade"'
-alias apud='su -c "aptitude update"'
-alias apug='su -c "aptitude safe-upgrade"'
+# apt-file
+alias afs='apt-file search --regexp'
+
+# These are apt-get only
+alias asrc='apt-get source'
+alias ap='apt-cache policy'
+
+# superuser operations ######################################################
+if [[ $use_sudo -eq 1 ]]; then
+# commands using sudo #######
+ alias aac="sudo $apt_pref autoclean"
+ alias abd="sudo $apt_pref build-dep"
+ alias ac="sudo $apt_pref clean"
+ alias ad="sudo $apt_pref update"
+ alias adg="sudo $apt_pref update && sudo $apt_pref upgrade"
+ alias adu="sudo $apt_pref update && sudo $apt_pref dist-upgrade"
+ alias afu='sudo apt-file update'
+ alias ag="sudo $apt_pref upgrade"
+ alias ai="sudo $apt_pref install"
+ alias ap="sudo $apt_pref purge"
+ alias ar="sudo $apt_pref remove"
+
+ # apt-get only
+ alias ads="sudo $apt_pref dselect-upgrade"
+
+ # Install all .deb files in the current directory.
+ # Warning: you will need to put the glob in single quotes if you use:
+ # glob_subst
+ alias di='sudo dpkg -i ./*.deb'
+
+ # Remove ALL kernel images and headers EXCEPT the one in use
+ alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
+ ?not(~n`uname -r`))'
+
+
+# commands using su #########
+else
+ alias aac='su -ls "'"$apt_pref"' autoclean" root'
+ abd() {
+ cmd="su -lc '$apt_pref build-dep $@' root"
+ print "$cmd"
+ eval "$cmd"
+ }
+ alias ac='su -ls "'"$apt_pref"' clean" root'
+ alias ad='su -lc "'"$apt_pref"' update" root'
+ alias adg='su -lc "'"$apt_pref"' update && aptitude safe-upgrade" root'
+ alias adu='su -lc "'"$apt_pref"' update && aptitude dist-upgrade" root'
+ alias afu='su -lc "apt-file update"'
+ alias ag='su -lc "'"$apt_pref"' safe-upgrade" root'
+ ai() {
+ cmd="su -lc 'aptitude -P install $@' root"
+ print "$cmd"
+ eval "$cmd"
+ }
+ ap() {
+ cmd="su -lc '$apt_pref -P purge $@' root"
+ print "$cmd"
+ eval "$cmd"
+ }
+ ar() {
+ cmd="su -lc '$apt_pref -P remove $@' root"
+ print "$cmd"
+ eval "$cmd"
+ }
+
+ # Install all .deb files in the current directory
+ # Assumes glob_subst is off
+ alias di='su -lc "dpkg -i ./*.deb" root'
+
+ # Remove ALL kernel images and headers EXCEPT the one in use
+ alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) \
+ ?not(~n`uname -r`))'\'' root'
+fi
+
+
+# Misc. #####################################################################
# print all installed packages
alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
-# Install all .deb files in the current directory.
-# Warning: you will need to put the glob in single quotes if you use:
-# glob_subst
-alias di='su -c "dpkg -i ./*.deb"'
-
# Create a basic .deb package
alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
-# Remove ALL kernel images and headers EXCEPT the one in use
-alias kclean='su -c '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'\'' root'
-# Functions #################################################################
+# Functions #################################################################
# create a simple script that can be used to 'duplicate' a system
apt-copy() {
- print '#!/bin/sh'"\n" > apt-copy.sh
+ print '#!/bin/sh'"\n" > apt-copy.sh
- list=$(perl -m'AptPkg::Cache' -e '$c=AptPkg::Cache->new; for (keys %$c){ push @a, $_ if $c->{$_}->{'CurrentState'} eq 'Installed';} print "$_ " for sort @a;')
+ cmd="$apt_pref install "
- print 'aptitude install '"$list\n" >> apt-copy.sh
+ for p in ${(f)"$(aptitude search -F "%p" --disable-columns \~i)"}; {
+ cmd="${cmd} ${p}"
+ }
- chmod +x apt-copy.sh
+ print $cmd "\n" >> apt-copy.sh
+
+ chmod +x apt-copy.sh
}
# Kernel-package building shortcut
-dbb-build () {
- MAKEFLAGS='' # temporarily unset MAKEFLAGS ( '-j3' will fail )
+kerndeb () {
+ # temporarily unset MAKEFLAGS ( '-j3' will fail )
+ MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
+ print '$MAKEFLAGS set to '"'$MAKEFLAGS'"
appendage='-custom' # this shows up in $ (uname -r )
revision=$(date +"%Y%m%d") # this shows up in the .deb file name
@@ -57,4 +147,3 @@ dbb-build () {
"$revision" kernel_image kernel_headers
}
-
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index 4fcf9425d..c1b382b2c 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -17,6 +17,7 @@ alias gca='git commit -v -a'
compdef _git gca=git-commit
alias gco='git checkout'
compdef _git gco=git-checkout
+alias gcm='git checkout master'
alias gb='git branch'
compdef _git gb=git-branch
alias gba='git branch -a'
@@ -33,6 +34,8 @@ alias gss='git status -s'
compdef _git gss=git-status
alias ga='git add'
compdef _git ga=git-add
+alias gm='git merge'
+compdef _git gm=git-merge
# Git and svn mix
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh
index 1eb338113..9b0d54602 100644
--- a/plugins/github/github.plugin.zsh
+++ b/plugins/github/github.plugin.zsh
@@ -1,6 +1,60 @@
-# hub alias from defunkt
-# https://github.com/defunkt/hub
-if [ "$commands[(I)hub]" ]; then
+# Setup hub function for git, if it is available; http://github.com/defunkt/hub
+if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then
# eval `hub alias -s zsh`
function git(){hub "$@"}
fi
+
+# Functions #################################################################
+
+# https://github.com/dbb
+
+
+# empty_gh [NAME_OF_REPO]
+#
+# Use this when creating a new repo from scratch.
+empty_gh() { # [NAME_OF_REPO]
+ repo = $1
+ ghuser=$( git config github.user )
+
+ mkdir "$repo"
+ cd "$repo"
+ git init
+ touch README
+ git add README
+ git commit -m 'Initial commit.'
+ git remote add origin git@github.com:${ghuser}/${repo}.git
+ git push -u origin master
+}
+
+# new_gh [DIRECTORY]
+#
+# Use this when you have a directory that is not yet set up for git.
+# This function will add all non-hidden files to git.
+new_gh() { # [DIRECTORY]
+ cd "$1"
+ ghuser=$( git config github.user )
+
+ git init
+ # add all non-dot files
+ print '.*'"\n"'*~' >> .gitignore
+ git add ^.*
+ git commit -m 'Initial commit.'
+ git remote add origin git@github.com:${ghuser}/${repo}.git
+ git push -u origin master
+}
+
+# exist_gh [DIRECTORY]
+#
+# Use this when you have a git repo that's ready to go and you want to add it
+# to your GitHub.
+exist_gh() { # [DIRECTORY]
+ cd "$1"
+ name=$( git config user.name )
+ ghuser=$( git config github.user )
+
+ git remote add origin git@github.com:${ghuser}/${repo}.git
+ git push -u origin master
+}
+
+# End Functions #############################################################
+
diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh
new file mode 100644
index 000000000..e59265d66
--- /dev/null
+++ b/plugins/gnu-utils/gnu-utils.plugin.zsh
@@ -0,0 +1,80 @@
+# ------------------------------------------------------------------------------
+# FILE: gnu-utils.plugin.zsh
+# DESCRIPTION: oh-my-zsh plugin file.
+# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
+# VERSION: 1.0.0
+# ------------------------------------------------------------------------------
+
+
+if [[ -x "${commands[gwhoami]}" ]]; then
+ __gnu_utils() {
+ emulate -L zsh
+ local gcmds
+ local gcmd
+ local cmd
+ local prefix
+
+ # coreutils
+ gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
+ 'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
+ 'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
+ 'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid'
+ 'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum'
+ 'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc'
+ 'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd'
+ 'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum'
+ 'gsha256sum' 'gsha384sum' 'gsha512sum' 'gshred' 'gshuf' 'gsleep' 'gsort'
+ 'gsplit' 'gstat' 'gstty' 'gsum' 'gsync' 'gtac' 'gtail' 'gtee' 'gtest'
+ 'gtimeout' 'gtouch' 'gtr' 'gtrue' 'gtruncate' 'gtsort' 'gtty' 'guname'
+ 'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
+ 'gwhoami' 'gyes')
+
+ # Not part of coreutils, installed separately.
+ gcmds+=('gsed' 'gtar' 'gtime')
+
+ for gcmd in "${gcmds[@]}"; do
+ #
+ # This method allows for builtin commands to be primary but it's
+ # lost if hash -r or rehash -f is executed. Thus, those two
+ # functions have to be wrapped.
+ #
+ (( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]}
+
+ #
+ # This method generates wrapper functions.
+ # It will override shell builtins.
+ #
+ # (( ${+commands[$gcmd]} )) && \
+ # eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }"
+
+ #
+ # This method is inflexible since the aliases are at risk of being
+ # overriden resulting in the BSD coreutils being called.
+ #
+ # (( ${+commands[$gcmd]} )) && \
+ # alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}"
+ done
+
+ return 0
+ }
+ __gnu_utils;
+
+ function hash() {
+ if [[ "$*" =~ "-(r|f)" ]]; then
+ builtin hash "$@"
+ __gnu_utils
+ else
+ builtin hash "$@"
+ fi
+ }
+
+ function rehash() {
+ if [[ "$*" =~ "-f" ]]; then
+ builtin rehash "$@"
+ __gnu_utils
+ else
+ builtin rehash "$@"
+ fi
+ }
+fi
+
diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh
new file mode 100644
index 000000000..fc4c78c50
--- /dev/null
+++ b/plugins/gradle/gradle.plugin.zsh
@@ -0,0 +1,119 @@
+#!zsh
+##############################################################################
+# A descriptive listing of core Gradle commands
+############################################################################
+function _gradle_core_commands() {
+ local ret=1 state
+ _arguments ':subcommand:->subcommand' && ret=0
+
+ case $state in
+ subcommand)
+ subcommands=(
+ "properties:Display all project properties"
+ "tasks:Calculate and display all tasks"
+ "dependencies:Calculate and display all dependencies"
+ "projects:Discover and display all sub-projects"
+ "build:Build the project"
+ "help:Display help"
+ )
+ _describe -t subcommands 'gradle subcommands' subcommands && ret=0
+ esac
+
+ return ret
+}
+
+function _gradle_arguments() {
+ _arguments -C \
+ '-a[Do not rebuild project dependencies]' \
+ '-h[Help]' \
+ '-D[System property]' \
+ '-d[Log at the debug level]' \
+ '--gui[Launches the Gradle GUI app]' \
+ '--stop[Stop the Gradle daemon]' \
+ '--daemon[Use the Gradle daemon]' \
+ '--no-daemon[Do not use the Gradle daemon]' \
+ '--no-opt[Do not perform any task optimization]' \
+ '-i[Log at the info level]' \
+ '-m[Dry run]' \
+ '-P[Set a project property]' \
+ '--profile[Profile the build time]' \
+ '-q[Log at the quiet level (only show errors)]' \
+ '-v[Print the Gradle version info]' \
+ '-x[Specify a task to be excluded]' \
+ '*::command:->command' \
+ && return 0
+}
+
+
+##############################################################################
+# Are we in a directory containing a build.gradle file?
+############################################################################
+function in_gradle() {
+ if [[ -f build.gradle ]]; then
+ echo 1
+ fi
+}
+
+############################################################################
+# Define the stat_cmd command based on platform behavior
+##########################################################################
+stat -f%m . > /dev/null 2>&1
+if [ "$?" = 0 ]; then
+ stat_cmd=(stat -f%m)
+else
+ stat_cmd=(stat -L --format=%Y)
+fi
+
+############################################################################## Examine the build.gradle file to see if its
+# timestamp has changed, and if so, regen
+# the .gradle_tasks cache file
+############################################################################
+_gradle_does_task_list_need_generating () {
+ if [ ! -f .gradletasknamecache ]; then return 0;
+ else
+ accurate=$($stat_cmd .gradletasknamecache)
+ changed=$($stat_cmd build.gradle)
+ return $(expr $accurate '>=' $changed)
+ fi
+}
+
+
+##############################################################################
+# Discover the gradle tasks by running "gradle tasks --all"
+############################################################################
+_gradle_tasks () {
+ if [ in_gradle ]; then
+ _gradle_arguments
+ if _gradle_does_task_list_need_generating; then
+ gradle tasks --all | grep "^[ ]*[a-zA-Z0-9]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
+ fi
+ compadd -X "==== Gradle Tasks ====" `cat .gradletasknamecache`
+ fi
+}
+
+_gradlew_tasks () {
+ if [ in_gradle ]; then
+ _gradle_arguments
+ if _gradle_does_task_list_need_generating; then
+ gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
+ fi
+ compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache`
+ fi
+}
+
+
+##############################################################################
+# Register the completions against the gradle and gradlew commands
+############################################################################
+compdef _gradle_tasks gradle
+compdef _gradlew_tasks gradlew
+
+
+##############################################################################
+# Open questions for future improvements:
+# 1) Should 'gradle tasks' use --all or just the regular set?
+# 2) Should gradlew use the same approach as gradle?
+# 3) Should only the " - " be replaced with a colon so it can work
+# with the richer descriptive method of _arguments?
+# gradle tasks | grep "^[a-zA-Z0-9]*\ -\ " | sed "s/ - /\:/"
+#############################################################################
diff --git a/plugins/grails/grails.plugin.zsh b/plugins/grails/grails.plugin.zsh
new file mode 100755
index 000000000..cc6f9c53b
--- /dev/null
+++ b/plugins/grails/grails.plugin.zsh
@@ -0,0 +1,54 @@
+_enumerateGrailsScripts() {
+ # Default directoryies
+ directories=($GRAILS_HOME/scripts ~/.grails/scripts ./scripts)
+
+ # Check all of the plugins directories, if they exist
+ if [ -d plugins ]
+ then
+ directories+=(plugins/*/scripts)
+ fi
+
+ # Enumerate all of the Groovy files
+ files=()
+ for dir in $directories;
+ do
+ if [ -d $dir ]
+ then
+ files+=($dir/[^_]*.groovy)
+ fi
+ done
+
+ # Don't try to basename ()
+ if [ ${#files} -eq 0 ];
+ then
+ return
+ fi
+
+ # - Strip the path
+ # - Remove all scripts with a leading '_'
+ # - PackagePlugin_.groovy -> PackagePlugin
+ # - PackagePlugin -> Package-Plugin
+ # - Package-Plugin -> package-plugin
+ basename $files \
+ | sed -E -e 's/^_?([^_]+)_?.groovy/\1/'\
+ -e 's/([a-z])([A-Z])/\1-\2/g' \
+ | tr "[:upper:]" "[:lower:]" \
+ | sort \
+ | uniq
+}
+
+_grails() {
+ if (( CURRENT == 2 )); then
+ scripts=( $(_enumerateGrailsScripts) )
+
+ if [ ${#scripts} -ne 0 ];
+ then
+ _multi_parts / scripts
+ return
+ fi
+ fi
+
+ _files
+}
+
+compdef _grails grails
diff --git a/plugins/knife/_knife b/plugins/knife/_knife
index 7f8c95ee5..32ff9fc99 100644
--- a/plugins/knife/_knife
+++ b/plugins/knife/_knife
@@ -26,7 +26,7 @@ _knife() {
case $state in
knifecmd)
- compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders
+ compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec environment index node recipe role search ssh status windows $cloudproviders
;;
knifesubcmd)
case $words[2] in
@@ -42,6 +42,9 @@ _knife() {
cookbook)
compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
;;
+ environment)
+ compadd -Q "$@" list create delete edit show "from file"
+ ;;
node)
compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
;;
@@ -161,6 +164,10 @@ _chef_data_bags_remote() {
(knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
+_chef_environments_remote() {
+ (knife environment list | awk '{print $1}')
+}
+
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
_chef_cookbooks_local() {
(for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh
new file mode 100644
index 000000000..2988f0a46
--- /dev/null
+++ b/plugins/mercurial/mercurial.plugin.zsh
@@ -0,0 +1,14 @@
+
+# Mercurial
+alias hgc='hg commit -v'
+alias hgb='hg branch -v'
+alias hgba='hg branches'
+alias hgco='hg checkout'
+alias hgd='hg diff'
+alias hged='hg diffmerge'
+# pull and update
+alias hgl='hg pull -u -v'
+alias hgp='hg push -v'
+alias hgs='hg status -v'
+# this is the 'git commit --amend' equivalent
+alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
diff --git a/plugins/npm/_npm b/plugins/npm/_npm
deleted file mode 100644
index 24b536188..000000000
--- a/plugins/npm/_npm
+++ /dev/null
@@ -1,19 +0,0 @@
-#compdef npm
-
-# Node Package Manager 0.3.15 completion, letting npm do all the completion work
-
-_npm() {
- compadd -- $(_npm_complete $words)
-}
-
-# We want to show all errors of any substance, but never the "npm (not )ok" one.
-# (Also doesn't consider "ERR! no match found" worth breaking the terminal for.)
-_npm_complete() {
- local ask_npm
- ask_npm=(npm completion --color false --loglevel error -- $@)
- { _call_program npm $ask_npm 2>&1 >&3 \
- | egrep -v '^(npm (not |)ok|ERR! no match found)$' >&2; \
- } 3>&1
-}
-
-_npm "$@"
diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh
new file mode 100644
index 000000000..c3eb91d31
--- /dev/null
+++ b/plugins/npm/npm.plugin.zsh
@@ -0,0 +1 @@
+eval "$(npm completion 2>/dev/null)"
diff --git a/plugins/nyan/nyan.plugin.zsh b/plugins/nyan/nyan.plugin.zsh
new file mode 100644
index 000000000..6321e5f5a
--- /dev/null
+++ b/plugins/nyan/nyan.plugin.zsh
@@ -0,0 +1,5 @@
+if [[ -x `which nc` ]]; then
+ alias nyan='nc -v miku.acm.uiuc.edu 23' # nyan cat
+fi
+
+
diff --git a/plugins/pip/_pip b/plugins/pip/_pip
index b58010173..df53ba5ce 100644
--- a/plugins/pip/_pip
+++ b/plugins/pip/_pip
@@ -3,30 +3,43 @@
# pip zsh completion, based on homebrew completion
+_pip_all() {
+ # we cache the list of packages (originally from the macports plugin)
+ if (( ! $+piplist )); then
+ echo -n " (caching package index...)"
+ piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]'))
+ fi
+}
+
_pip_installed() {
- installed_pkgs=(`pip freeze`)
+ installed_pkgs=(`pip freeze | cut -d '=' -f 1`)
}
local -a _1st_arguments
_1st_arguments=(
- 'bundle:Create pybundles (archives containing multiple packages)'
- 'freeze:Output all currently installed packages (exact versions) to stdout'
- 'help:Show available commands'
- 'install:Install packages'
- 'search:Search PyPI'
- 'uninstall:Uninstall packages'
- 'unzip:Unzip individual packages'
- 'zip:Zip individual packages'
+ 'bundle:create pybundles (archives containing multiple packages)'
+ 'freeze:output all currently installed packages (exact versions) to stdout'
+ 'help:show available commands'
+ 'install:install packages'
+ 'search:search PyPI'
+ 'uninstall:uninstall packages'
+ 'unzip:unzip individual packages'
+ 'zip:zip individual packages'
)
local expl
-local -a pkgs installed_pkgs
+local -a all_pkgs installed_pkgs
_arguments \
- '(--version)--version[Show version number of program and exit]' \
- '(-v --verbose)'{-v,--verbose}'[Give more output]' \
- '(-q --quiet)'{-q,--quiet}'[Give less output]' \
- '(-h --help)'{-h,--help}'[Show help]' \
+ '(--version)--version[show version number of program and exit]' \
+ '(-h --help)'{-h,--help}'[show help]' \
+ '(-E --environment)'{-E,--environment}'[virtualenv environment to run pip in]' \
+ '(-s --enable-site-packages)'{-s,--enable-site-packages}'[include site-packages in virtualenv]' \
+ '(-v --verbose)'{-v,--verbose}'[give more output]' \
+ '(-q --quiet)'{-q,--quiet}'[give less output]' \
+ '(--log)--log[log file location]' \
+ '(--proxy)--proxy[proxy in form user:passwd@proxy.server:port]' \
+ '(--timeout)--timeout[socket timeout (default 15s)]' \
'*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
@@ -35,10 +48,25 @@ if (( CURRENT == 1 )); then
fi
case "$words[1]" in
- list)
- if [[ "$state" == forms ]]; then
- _pip_installed
- _requested installed_pkgs expl 'installed packages' compadd -a installed_pkgs
+ search)
+ _arguments \
+ '(--index)--index[base URL of Python Package Index]' ;;
+ freeze)
+ _arguments \
+ '(-l --local)'{-l,--local}'[report only virtualenv packages]' ;;
+ install)
+ _arguments \
+ '(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \
+ '(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \
+ '(--no-deps --no-dependencies)'{--no-deps,--no-dependencies}'[iIgnore package dependencies]' \
+ '(--no-install)--no-install[only download packages]' \
+ '(--no-download)--no-download[only install downloaded packages]' \
+ '(--install-option)--install-option[extra arguments to be supplied to the setup.py]' \
+ '1: :->packages' && return 0
+
+ if [[ "$state" == packages ]]; then
+ _pip_all
+ _wanted piplist expl 'packages' compadd -a piplist
fi ;;
uninstall)
_pip_installed
diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh
new file mode 100644
index 000000000..3ea34d718
--- /dev/null
+++ b/plugins/python/python.plugin.zsh
@@ -0,0 +1,5 @@
+# Find python file
+alias pyfind='find . -name "*.py"'
+
+# Remove python compiled byte-code
+alias pyclean='find . -type f -name "*.py[co]" -exec rm -f \{\} \;'
diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh
index f4ee637e6..792cde2bd 100644
--- a/plugins/rails3/rails3.plugin.zsh
+++ b/plugins/rails3/rails3.plugin.zsh
@@ -17,3 +17,5 @@ alias rp='_rails_command plugin'
alias rs='_rails_command server'
alias rsd='_rails_command server --debugger'
alias devlog='tail -f log/development.log'
+alias rdm='rake db:migrate'
+alias rdr='rake db:rollback'
diff --git a/plugins/sprunge/sprunge.plugin.zsh b/plugins/sprunge/sprunge.plugin.zsh
new file mode 100644
index 000000000..9f9432ac8
--- /dev/null
+++ b/plugins/sprunge/sprunge.plugin.zsh
@@ -0,0 +1,64 @@
+# Contributed and SLIGHTLY modded by Matt Parnell/ilikenwf <parwok -at- gmail>
+# Created by the blogger at the URL below...I don't know where to find his/her name
+# Original found at http://www.shellperson.net/sprunge-pastebin-script/
+
+usage() {
+description | fmt -s >&2
+}
+
+description() {
+cat << HERE
+
+DESCRIPTION
+ Upload data and fetch URL from the pastebin http://sprunge.us
+
+USAGE
+ $0 filename.txt
+ $0 text string
+ $0 < filename.txt
+ piped_data | $0
+
+NOTES
+--------------------------------------------------------------------------
+* INPUT METHODS *
+$0 can accept piped data, STDIN redirection [<filename.txt], text strings following the command as arguments, or filenames as arguments. Only one of these methods can be used at a time, so please see the note on precedence. Also, note that using a pipe or STDIN redirection will treat tabs as spaces, or disregard them entirely (if they appear at the beginning of a line). So I suggest using a filename as an argument if tabs are important either to the function or readability of the code.
+
+* PRECEDENCE *
+STDIN redirection has precedence, then piped input, then a filename as an argument, and finally text strings as an arguments.
+
+ EXAMPLE:
+ echo piped | "$0" arguments.txt < stdin_redirection.txt
+
+In this example, the contents of file_as_stdin_redirection.txt would be uploaded. Both the piped_text and the file_as_argument.txt are ignored. If there is piped input and arguments, the arguments will be ignored, and the piped input uploaded.
+
+* FILENAMES *
+If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but will instead treat it as a text string and upload it.
+--------------------------------------------------------------------------
+
+HERE
+exit
+}
+
+sprunge() {
+ if [ -t 0 ]; then
+ echo Running interactively, checking for arguments... >&2
+ if [ "$*" ]; then
+ echo Arguments present... >&2
+ if [ -f "$*" ]; then
+ echo Uploading the contents of "$*"... >&2
+ cat "$*"
+ else
+ echo Uploading the text: \""$*"\"... >&2
+ echo "$*"
+ fi | curl -F 'sprunge=<-' http://sprunge.us
+ else
+ echo No arguments found, printing USAGE and exiting. >&2
+ usage
+ fi
+ else
+ echo Using input from a pipe or STDIN redirection... >&2
+ while read -r line ; do
+ echo $line
+ done | curl -F 'sprunge=<-' http://sprunge.us
+ fi
+}
diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh
index 53a8a513a..e2cf96ca3 100644
--- a/plugins/svn/svn.plugin.zsh
+++ b/plugins/svn/svn.plugin.zsh
@@ -1,5 +1,5 @@
function svn_prompt_info {
- if [ in_svn ]; then
+ if [ $(in_svn) ]; then
echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
$ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR"
fi
@@ -13,7 +13,7 @@ function in_svn() {
}
function svn_get_repo_name {
- if [ in_svn ]; then
+ if [ $(in_svn) ]; then
svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//"
@@ -21,13 +21,13 @@ function svn_get_repo_name {
}
function svn_get_rev_nr {
- if [ in_svn ]; then
+ if [ $(in_svn) ]; then
svn info 2> /dev/null | sed -n s/Revision:\ //p
fi
}
function svn_dirty_choose {
- if [ in_svn ]; then
+ if [ $(in_svn) ]; then
s=$(svn status|grep -E '^\s*[ACDIM!?L]' 2>/dev/null)
if [ $s ]; then
echo $1
diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh
new file mode 100644
index 000000000..644266841
--- /dev/null
+++ b/plugins/symfony2/symfony2.plugin.zsh
@@ -0,0 +1,13 @@
+# Symfony2 basic command completion
+
+_symfony2_get_command_list () {
+ app/console --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
+}
+
+_symfony2 () {
+ if [ -f app/console ]; then
+ compadd `_symfony2_get_command_list`
+ fi
+}
+
+compdef _symfony2 app/console \ No newline at end of file
diff --git a/plugins/terminitor/_terminitor b/plugins/terminitor/_terminitor
new file mode 100644
index 000000000..1ce87c3ad
--- /dev/null
+++ b/plugins/terminitor/_terminitor
@@ -0,0 +1,38 @@
+#compdef terminitor
+#autoload
+
+# terminitor zsh completion
+
+_terminitor_available_scripts() {
+ scripts=(`for SCRIPT in ~/.config/terminitor/*.term ; do basename $SCRIPT .term ; done`)
+}
+
+local -a _1st_arguments
+_1st_arguments=(
+ 'create:create a Termfile in directory'
+ 'delete:delete terminitor script'
+ 'edit:open termitor script'
+ 'fetch:clone the designated repo and run setup'
+ 'help:Describe available tasks or one specific task'
+ 'init:create initial root terminitor folder'
+ 'list:lists all terminitor scripts'
+ 'setup:execute setup in the terminitor script'
+ 'start:runs the terminitor script'
+ 'update:update Terminitor to new global path(.config/.terminitor)'
+)
+
+local expl
+
+_arguments \
+ '*:: :->subcmds' && return 0
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "terminitor task" _1st_arguments
+ return
+fi
+
+case "$words[1]" in
+ start|edit|delete|setup)
+ _terminitor_available_scripts
+ _wanted scripts expl 'installed scripts' compadd -a scripts ;;
+esac
diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh
index aa2f75f4f..a11a097f5 100644
--- a/plugins/textmate/textmate.plugin.zsh
+++ b/plugins/textmate/textmate.plugin.zsh
@@ -1,5 +1,5 @@
alias et='mate .'
-alias ett='mate app config lib db public spec test Rakefile Capfile Todo'
+alias ett='mate Gemfile app config features 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'
diff --git a/plugins/vundle/vundle.plugin.zsh b/plugins/vundle/vundle.plugin.zsh
new file mode 100644
index 000000000..005a58476
--- /dev/null
+++ b/plugins/vundle/vundle.plugin.zsh
@@ -0,0 +1,23 @@
+function vundle-init () {
+ if [ ! -d ~/.vim/bundle/vundle/ ]
+ then
+ mkdir -p ~/.vim/bundle/vundle/
+ fi
+
+ if [ ! -d ~/.vim/bundle/vundle/.git/ ]
+ then
+ git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
+ echo "\n\tRead about vim configuration for vundle at https://github.com/gmarik/vundle\n"
+ fi
+}
+
+function vundle () {
+ vundle-init
+ vim -c "execute \"BundleInstall\" | q | q"
+}
+
+
+function vundle-update () {
+ vundle-init
+ vim -c "execute \"BundleInstall!\" | q | q"
+}
diff --git a/plugins/wakeonlan/README b/plugins/wakeonlan/README
new file mode 100644
index 000000000..16fdd4587
--- /dev/null
+++ b/plugins/wakeonlan/README
@@ -0,0 +1,29 @@
+This plugin provides a wrapper around the "wakeonlan" tool available from most
+distributions' package repositories, or from the following website:
+
+http://gsd.di.uminho.pt/jpo/software/wakeonlan/
+
+In order to use this wrapper, create the ~/.wakeonlan directory, and place in
+that directory one file for each device you would like to be able to wake. Give
+the file a name that describes the device, such as its hostname. Each file
+should contain a line with the mac address of the target device and the network
+broadcast address.
+
+For instance, there might be a file ~/.wakeonlan/leto with the following
+contents:
+
+00:11:22:33:44:55:66 192.168.0.255
+
+To wake that device, use the following command:
+
+# wake leto
+
+The available device names will be autocompleted, so:
+
+# wake <tab>
+
+...will suggest "leto", along with any other configuration files that were
+placed in the ~/.wakeonlan directory.
+
+For more information regarding the configuration file format, check the
+wakeonlan man page.
diff --git a/plugins/wakeonlan/_wake b/plugins/wakeonlan/_wake
new file mode 100644
index 000000000..4ab10d374
--- /dev/null
+++ b/plugins/wakeonlan/_wake
@@ -0,0 +1,4 @@
+#compdef wake
+#autoload
+
+_arguments "1:device to wake:_files -W '$HOME/.wakeonlan'" && return 0
diff --git a/plugins/wakeonlan/wakeonlan.plugin.zsh b/plugins/wakeonlan/wakeonlan.plugin.zsh
new file mode 100644
index 000000000..6cef7d44a
--- /dev/null
+++ b/plugins/wakeonlan/wakeonlan.plugin.zsh
@@ -0,0 +1,14 @@
+function wake() {
+ local config_file="$HOME/.wakeonlan/$1"
+ if [[ ! -f "$config_file" ]]; then
+ echo "ERROR: There is no configuration file at \"$config_file\"."
+ return 1
+ fi
+
+ if (( ! $+commands[wakeonlan] )); then
+ echo "ERROR: Can't find \"wakeonlan\". Are you sure it's installed?"
+ return 1
+ fi
+
+ wakeonlan -f "$config_file"
+}