summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/archlinux/archlinux.plugin.zsh1
-rw-r--r--plugins/autojump/autojump.plugin.zsh12
-rw-r--r--plugins/battery/battery.plugin.zsh20
-rw-r--r--plugins/bundler/bundler.plugin.zsh10
-rw-r--r--plugins/debian/debian.plugin.zsh42
-rw-r--r--plugins/django/django.plugin.zsh1
-rw-r--r--plugins/extract/extract.plugin.zsh5
-rw-r--r--plugins/git/git.plugin.zsh7
-rw-r--r--plugins/github/github.plugin.zsh12
-rw-r--r--plugins/jake-node/jake-node.plugin.zsh14
-rw-r--r--plugins/knife/_knife21
-rw-r--r--plugins/mercurial/mercurial.plugin.zsh10
-rw-r--r--plugins/pow/pow.plugin.zsh70
-rw-r--r--plugins/rails/rails.plugin.zsh1
-rw-r--r--plugins/rails3/rails3.plugin.zsh1
-rw-r--r--plugins/rake/rake.plugin.zsh6
-rw-r--r--plugins/rbenv/rbenv.plugin.zsh44
-rw-r--r--plugins/ruby/ruby.plugin.zsh2
-rw-r--r--plugins/rvm/rvm.plugin.zsh2
-rw-r--r--plugins/sprunge/sprunge.plugin.zsh64
-rw-r--r--plugins/symfony2/symfony2.plugin.zsh13
-rw-r--r--plugins/taskwarrior/_task162
-rw-r--r--plugins/terminalapp/terminalapp.plugin.zsh11
23 files changed, 389 insertions, 142 deletions
diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh
index b5e519036..294dc5354 100644
--- a/plugins/archlinux/archlinux.plugin.zsh
+++ b/plugins/archlinux/archlinux.plugin.zsh
@@ -9,6 +9,7 @@ if [[ -x `which yaourt` ]]; then
alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
+ alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation
alias yain='yaourt -S' # Install specific package(s) from the repositories
alias yains='yaourt -U' # Install specific package not from the repositories but from a file
alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
index 6f9b80bff..6f0edb062 100644
--- a/plugins/autojump/autojump.plugin.zsh
+++ b/plugins/autojump/autojump.plugin.zsh
@@ -1,5 +1,9 @@
-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
+if [ $commands[autojump] ]; then # check if autojump is installed
+ if [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package
+ . /usr/share/autojump/autojump.zsh
+ elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
+ . /etc/profile.d/autojump.zsh
+ elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump ]; then # mac os x with brew
+ . `brew --prefix`/etc/autojump
+ fi
fi
diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh
new file mode 100644
index 000000000..bc75c5cf9
--- /dev/null
+++ b/plugins/battery/battery.plugin.zsh
@@ -0,0 +1,20 @@
+if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
+ function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" }
+ function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') }
+ function battery_pct_prompt() {
+ b=$(battery_pct_remaining)
+ if [ $b -gt 50 ] ; then
+ color='green'
+ elif [ $b -gt 20 ] ; then
+ color='yellow'
+ else
+ color='red'
+ fi
+ echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
+ }
+else
+ error_msg='no battery'
+ function battery_pct_remaining() { echo $error_msg }
+ function battery_time_remaining() { echo $error_msg }
+ function battery_pct_prompt() { echo '' }
+fi
diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
index 3c96b8da9..e1f571237 100644
--- a/plugins/bundler/bundler.plugin.zsh
+++ b/plugins/bundler/bundler.plugin.zsh
@@ -1,7 +1,3 @@
-fpath=($ZSH/plugins/bundler $fpath)
-autoload -U compinit
-compinit -i
-
alias be="bundle exec"
alias bi="bundle install"
alias bl="bundle list"
@@ -10,7 +6,7 @@ alias bu="bundle update"
# The following is based on https://github.com/gma/bundler-exec
-bundled_commands=(cap capify cucumber foreman guard heroku nanoc rackup rails rainbows rake rspec ruby shotgun spec spork thin unicorn unicorn_rails)
+bundled_commands=(annotate cap capify cucumber ey foreman guard heroku middleman nanoc rackup rainbows rails rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails)
## Functions
@@ -20,7 +16,7 @@ _bundler-installed() {
_within-bundled-project() {
local check_dir=$PWD
- while [ "$(dirname $check_dir)" != "/" ]; do
+ while [ $check_dir != "/" ]; do
[ -f "$check_dir/Gemfile" ] && return
check_dir="$(dirname $check_dir)"
done
@@ -41,6 +37,6 @@ for cmd in $bundled_commands; do
alias $cmd=bundled_$cmd
if which _$cmd > /dev/null 2>&1; then
- compdef _$cmd bundled_$cmd
+ compdef _$cmd bundled_$cmd=$cmd
fi
done
diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
index 09771881d..16a5d54ca 100644
--- a/plugins/debian/debian.plugin.zsh
+++ b/plugins/debian/debian.plugin.zsh
@@ -54,7 +54,7 @@ if [[ $use_sudo -eq 1 ]]; then
# 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
@@ -113,9 +113,6 @@ alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
-
-
-
# Functions #################################################################
# create a simple script that can be used to 'duplicate' a system
apt-copy() {
@@ -132,11 +129,46 @@ apt-copy() {
chmod +x apt-copy.sh
}
+# Prints apt history
+# Usage:
+# apt-history install
+# apt-history upgrade
+# apt-history remove
+# apt-history rollback
+# apt-history list
+# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
+apt-history () {
+ case "$1" in
+ install)
+ zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*)
+ ;;
+ upgrade|remove)
+ zgrep --no-filename $1 $(ls -rt /var/log/dpkg*)
+ ;;
+ rollback)
+ zgrep --no-filename upgrade $(ls -rt /var/log/dpkg*) | \
+ grep "$2" -A10000000 | \
+ grep "$3" -B10000000 | \
+ awk '{print $4"="$5}'
+ ;;
+ list)
+ zcat $(ls -rt /var/log/dpkg*)
+ ;;
+ *)
+ echo "Parameters:"
+ echo " install - Lists all packages that have been installed."
+ echo " upgrade - Lists all packages that have been upgraded."
+ echo " remove - Lists all packages that have been removed."
+ echo " rollback - Lists rollback information."
+ echo " list - Lists all contains of dpkg logs."
+ ;;
+ esac
+}
# Kernel-package building shortcut
kerndeb () {
# temporarily unset MAKEFLAGS ( '-j3' will fail )
- MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
+ 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
diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh
index 1d72a2f2c..0bbd031fe 100644
--- a/plugins/django/django.plugin.zsh
+++ b/plugins/django/django.plugin.zsh
@@ -220,3 +220,4 @@ _managepy() {
compdef _managepy manage.py
compdef _managepy django
+compdef _managepy django-manage
diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
index 8cc17f7d4..5c125e98b 100644
--- a/plugins/extract/extract.plugin.zsh
+++ b/plugins/extract/extract.plugin.zsh
@@ -78,8 +78,3 @@ function extract() {
alias x=extract
-# add extract completion function to path
-fpath=($ZSH/plugins/extract $fpath)
-autoload -U compinit
-compinit -i
-
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index 183c56c1c..e1d682508 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -9,7 +9,7 @@ alias gup='git fetch && git rebase'
compdef _git gup=git-fetch
alias gp='git push'
compdef _git gp=git-push
-gdv() { git-diff -w "$@" | view - }
+gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff
alias gc='git commit -v'
compdef _git gc=git-commit
@@ -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'
@@ -35,6 +36,8 @@ alias ga='git add'
compdef _git ga=git-add
alias gm='git merge'
compdef _git gm=git-merge
+alias grh='git reset HEAD'
+alias grhh='git reset HEAD --hard'
# Git and svn mix
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
@@ -57,4 +60,4 @@ compdef ggpull=git
alias ggpush='git push origin $(current_branch)'
compdef ggpush=git
alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
-compdef ggpnp=git
+compdef ggpnp=git \ No newline at end of file
diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh
index 9b0d54602..197e86a48 100644
--- a/plugins/github/github.plugin.zsh
+++ b/plugins/github/github.plugin.zsh
@@ -1,7 +1,17 @@
# 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 "$@"}
+ function git(){
+ if ! (( $+_has_working_hub )); then
+ hub --version &> /dev/null
+ _has_working_hub=$(($? == 0))
+ fi
+ if (( $_has_working_hub )) ; then
+ hub "$@"
+ else
+ command git "$@"
+ fi
+ }
fi
# Functions #################################################################
diff --git a/plugins/jake-node/jake-node.plugin.zsh b/plugins/jake-node/jake-node.plugin.zsh
new file mode 100644
index 000000000..a9eef4029
--- /dev/null
+++ b/plugins/jake-node/jake-node.plugin.zsh
@@ -0,0 +1,14 @@
+#---oh-my-zsh plugin : task Autocomplete for Jake tool---
+# Jake : https://github.com/mde/jake
+# Warning : Jakefile should have the right case : Jakefile or jakefile
+# Tested on : MacOSX 10.7 (Lion), Ubuntu 11.10
+# Author : Alexandre Lacheze (@al3xstrat)
+# Inspiration : http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh
+
+function _jake () {
+ if [ -f Jakefile ]||[ -f jakefile ]; then
+ compadd `jake -T | cut -d " " -f 2 | sed -E "s/.\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"`
+ fi
+}
+
+compdef _jake jake \ No newline at end of file
diff --git a/plugins/knife/_knife b/plugins/knife/_knife
index 7f8c95ee5..8453af5be 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"
;;
@@ -138,27 +141,31 @@ _knife_options3() {
# The chef_x_remote functions use knife to get a list of objects of type x on the server
_chef_roles_remote() {
- (knife role list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_clients_remote() {
- (knife client list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_nodes_remote() {
- (knife node list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_cookbooks_remote() {
- (knife cookbook list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_sitecookbooks_remote() {
- (knife cookbook site list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_data_bags_remote() {
- (knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife data bag list --format json | 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
diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh
index 2988f0a46..caf0d9efc 100644
--- a/plugins/mercurial/mercurial.plugin.zsh
+++ b/plugins/mercurial/mercurial.plugin.zsh
@@ -1,14 +1,14 @@
# Mercurial
-alias hgc='hg commit -v'
-alias hgb='hg branch -v'
+alias hgc='hg commit'
+alias hgb='hg branch'
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'
+alias hgl='hg pull -u'
+alias hgp='hg push'
+alias hgs='hg status'
# this is the 'git commit --amend' equivalent
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh
index 6b2a6f2be..399a54cb0 100644
--- a/plugins/pow/pow.plugin.zsh
+++ b/plugins/pow/pow.plugin.zsh
@@ -1,10 +1,66 @@
-# 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
+# Restart a rack app running under pow
+# http://pow.cx/
+#
+# Adds a kapow command that will restart an app
+#
+# $ kapow myapp
+#
+# Supports command completion.
+#
+# If you are not already using completion you might need to enable it with
+#
+# autoload -U compinit compinit
+#
+# Changes:
+#
+# Defaults to the current application, and will walk up the tree to find
+# a config.ru file and restart the corresponding app
+#
+# Will Detect if a app does not exist in pow and print a (slightly) helpful
+# error message
+
+rack_root_detect(){
+ setopt chaselinks
+ local orgdir=$(pwd)
+ local basedir=$(pwd)
+
+ while [[ $basedir != '/' ]]; do
+ test -e "$basedir/config.ru" && break
+ builtin cd ".." 2>/dev/null
+ basedir="$(pwd)"
+ done
+
+ builtin cd $orgdir 2>/dev/null
+ [[ ${basedir} == "/" ]] && return 1
+ echo `basename $basedir | sed -E "s/.(com|net|org)//"`
}
+kapow(){
+ local vhost=$1
+ [ ! -n "$vhost" ] && vhost=$(rack_root_detect)
+ if [ ! -h ~/.pow/$vhost ]
+ then
+ echo "pow: This domain isn’t set up yet. Symlink your application to ${vhost} first."
+ return 1
+ fi
+
+ [ ! -d ~/.pow/${vhost}/tmp ] && mkdir -p ~/.pow/$vhost/tmp
+ touch ~/.pow/$vhost/tmp/restart.txt;
+ [ $? -eq 0 ] && echo "pow: restarting $vhost.dev"
+}
compctl -W ~/.pow -/ kapow
+
+powit(){
+ local basedir=$(pwd)
+ local vhost=$1
+ [ ! -n "$vhost" ] && vhost=$(rack_root_detect)
+ if [ ! -h ~/.pow/$vhost ]
+ then
+ echo "pow: Symlinking your app with pow. ${vhost}"
+ [ ! -d ~/.pow/${vhost} ] && ln -s $basedir ~/.pow/$vhost
+ return 1
+ fi
+}
+
+# View the standard out (puts) from any pow app
+alias kaput="tail -f ~/Library/Logs/Pow/apps/*"
diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh
index ac8119e83..4aa7a05d6 100644
--- a/plugins/rails/rails.plugin.zsh
+++ b/plugins/rails/rails.plugin.zsh
@@ -2,6 +2,7 @@ alias ss='thin --stats "/thin/stats" start'
alias sg='ruby script/generate'
alias sd='ruby script/destroy'
alias sp='ruby script/plugin'
+alias sr='ruby script/runner'
alias ssp='ruby script/spec'
alias rdbm='rake db:migrate'
alias sc='ruby script/console'
diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh
index 792cde2bd..d4c7df654 100644
--- a/plugins/rails3/rails3.plugin.zsh
+++ b/plugins/rails3/rails3.plugin.zsh
@@ -14,6 +14,7 @@ alias rdb='_rails_command dbconsole'
alias rdbm='rake db:migrate db:test:clone'
alias rg='_rails_command generate'
alias rp='_rails_command plugin'
+alias ru='_rails_command runner'
alias rs='_rails_command server'
alias rsd='_rails_command server --debugger'
alias devlog='tail -f log/development.log'
diff --git a/plugins/rake/rake.plugin.zsh b/plugins/rake/rake.plugin.zsh
new file mode 100644
index 000000000..16b933c14
--- /dev/null
+++ b/plugins/rake/rake.plugin.zsh
@@ -0,0 +1,6 @@
+alias rake="noglob rake" # allows square brackts for rake task invocation
+alias brake='noglob bundle exec rake' # execute the bundled rake gem
+alias srake='noglob sudo rake' # noglob must come before sudo
+alias sbrake='noglob sudo bundle exec rake' # altogether now ...
+
+
diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh
new file mode 100644
index 000000000..ae37404cd
--- /dev/null
+++ b/plugins/rbenv/rbenv.plugin.zsh
@@ -0,0 +1,44 @@
+FOUND_RBENV=0
+for rbenvdir in "$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" ; do
+ if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then
+ FOUND_RBENV=1
+ export RBENV_ROOT=$rbenvdir
+ export PATH=${rbenvdir}/bin:$PATH
+ eval "$(rbenv init -)"
+
+ alias rubies="rbenv versions"
+ alias gemsets="rbenv gemset list"
+
+ function current_ruby() {
+ echo "$(rbenv version-name)"
+ }
+
+ function current_gemset() {
+ echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)"
+ }
+
+ function gems {
+ local rbenv_path=$(rbenv prefix)
+ gem list $@ | sed \
+ -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
+ -Ee "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_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"
+ }
+
+ function rbenv_prompt_info() {
+ if [[ -n $(current_gemset) ]] ; then
+ echo "$(current_ruby)@$(current_gemset)"
+ else
+ echo "$(current_ruby)"
+ fi
+ }
+ fi
+done
+unset rbenvdir
+
+if [ $FOUND_RBENV -eq 0 ] ; then
+ alias rubies='ruby -v'
+ function gemsets() { echo 'not supported' }
+ function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" }
+fi
diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh
index 08ca9c601..38e4d7cd0 100644
--- a/plugins/ruby/ruby.plugin.zsh
+++ b/plugins/ruby/ruby.plugin.zsh
@@ -3,4 +3,4 @@
alias sgem='sudo gem'
# Find ruby file
-alias rfind='find . -name *.rb | xargs grep -n'
+alias rfind='find . -name "*.rb" | xargs grep -n'
diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh
index 24621fe0b..604c00713 100644
--- a/plugins/rvm/rvm.plugin.zsh
+++ b/plugins/rvm/rvm.plugin.zsh
@@ -37,7 +37,7 @@ function gems {
local current_gemset=`rvm-prompt g`
gem list $@ | sed \
- -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
+ -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/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/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/taskwarrior/_task b/plugins/taskwarrior/_task
index 5bffa9119..0bda738bb 100644
--- a/plugins/taskwarrior/_task
+++ b/plugins/taskwarrior/_task
@@ -1,37 +1,37 @@
#compdef task
-#
# zsh completion for taskwarrior
#
+# taskwarrior - a command line task list manager.
+#
# Copyright 2010 - 2011 Johannes Schlatow
# Copyright 2009 P.C. Shyamshankar
-# All rights reserved.
-#
-# This script is part of the taskwarrior project.
#
-# 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 2 of the License, or (at your option) any later
-# version.
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
#
-# 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.
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
#
-# Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor,
-# Boston, MA
-# 02110-1301
-# USA
+# http://www.opensource.org/licenses/mit-license.php
#
typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
_task_projects=($(task _projects))
_task_tags=($(task _tags))
_task_ids=($(task _ids))
_task_config=($(task _config))
+_task_columns=($(task _columns))
_task_modifiers=(
'before' \
'after' \
@@ -46,39 +46,19 @@ _task_modifiers=(
'word' \
'noword'
)
+_task_conjunctions=(
+ 'and' \
+ 'or' \
+ 'xor' \
+ '\)'
+ '\('
+)
_task_cmds=($(task _commands))
_task_zshcmds=( ${(f)"$(task _zshcommands)"} )
-
-_task_idCmds=(
- 'append' \
- 'prepend' \
- 'annotate' \
- 'denotate' \
- 'edit' \
- 'duplicate' \
- 'info' \
- 'start' \
- 'stop' \
- 'done'
-)
-
-_task_idCmdsDesc=(
- 'append:Appends more description to an existing task.' \
- 'prepend:Prepends more description to an existing task.' \
- 'annotate:Adds an annotation to an existing task.' \
- 'denotate:Deletes an annotation of an existing task.' \
- 'edit:Launches an editor to let you modify a task directly.' \
- 'duplicate:Duplicates the specified task, and allows modifications.' \
- 'info:Shows all data, metadata for specified task.' \
- 'start:Marks specified task as started.' \
- 'stop:Removes the start time from a task.' \
- 'done:Marks the specified task as completed.'
-)
-
_task() {
_arguments -s -S \
- "*::task command:_task_commands"
+ "*::task default:_task_default"
return 0
}
@@ -148,6 +128,7 @@ _regex_words values 'task frequencies' \
'weekly:Every week' \
'biweekly:Every two weeks' \
'fortnight:Every two weeks' \
++ 'monthly:Every month' \
'quarterly:Every three months' \
'semiannual:Every six months' \
'annual:Every year' \
@@ -196,22 +177,13 @@ _regex_arguments _task_attributes "${args[@]}"
## task commands
-# default completion
-(( $+functions[_task_default] )) ||
-_task_default() {
+# filter completion
+(( $+functions[_task_filter] )) ||
+_task_filter() {
_task_attributes "$@"
-}
-# commands expecting an ID
-(( $+functions[_task_id] )) ||
-_task_id() {
- if (( CURRENT < 3 )); then
- # update IDs
- _task_zshids=( ${(f)"$(task _zshids)"} )
- _describe -t values 'task IDs' _task_zshids
- else
- _task_attributes "$@"
- fi
+ # TODO complete conjunctions only if the previous word is a filter expression, i.e. attribute, ID, any non-command
+ _describe -t default 'task conjunctions' _task_conjunctions
}
# merge completion
@@ -235,46 +207,42 @@ _task_pull() {
_files
}
+# execute completion
+(( $+functions[_task_execute] )) ||
+_task_execute() {
+ _files
+}
-# modify (task [0-9]* ...) completion
-(( $+functions[_task_modify] )) ||
-_task_modify() {
- _describe -t commands 'task command' _task_idCmdsDesc
- _task_attributes "$@"
+# id-only completion
+(( $+functions[_task_id] )) ||
+_task_id() {
+ _describe -t values 'task IDs' _task_zshids
}
## first level completion => task sub-command completion
-(( $+functions[_task_commands] )) ||
-_task_commands() {
+(( $+functions[_task_default] )) ||
+_task_default() {
local cmd ret=1
- if (( CURRENT == 1 )); then
- # update IDs
- _task_zshids=( ${(f)"$(task _zshids)"} )
-
- _describe -t commands 'task command' _task_zshcmds
- _describe -t values 'task IDs' _task_zshids
- # TODO match more than one ID
- elif [[ $words[1] =~ ^[0-9]*$ ]] then
- _call_function ret _task_modify
- return ret
- else
-# local curcontext="${curcontext}"
-# cmd="${_task_cmds[(r)$words[1]:*]%%:*}"
- cmd="${_task_cmds[(r)$words[1]]}"
- idCmd="${(M)_task_idCmds[@]:#$words[1]}"
- if (( $#cmd )); then
-# curcontext="${curcontext%:*:*}:task-${cmd}"
- if (( $#idCmd )); then
- _call_function ret _task_id
- else
- _call_function ret _task_${cmd} ||
- _call_function ret _task_default ||
- _message "No command remaining."
- fi
- else
- _message "Unknown subcommand ${cmd}"
- fi
- return ret
- fi
+ integer i=1
+ while (( i < $#words ))
+ do
+ cmd="${_task_cmds[(r)$words[$i]]}"
+ if (( $#cmd )); then
+ _call_function ret _task_${cmd} ||
+ _call_function ret _task_filter ||
+ _message "No command remaining."
+ return ret
+ fi
+ (( i++ ))
+ done
+
+ # update IDs
+ _task_zshids=( ${(f)"$(task _zshids)"} )
+
+ _describe -t commands 'task command' _task_zshcmds
+ _describe -t values 'task IDs' _task_zshids
+ _call_function ret _task_filter
+
+ return ret
}
diff --git a/plugins/terminalapp/terminalapp.plugin.zsh b/plugins/terminalapp/terminalapp.plugin.zsh
new file mode 100644
index 000000000..4695ad055
--- /dev/null
+++ b/plugins/terminalapp/terminalapp.plugin.zsh
@@ -0,0 +1,11 @@
+# Set Apple Terminal.app resume directory
+# based on this answer: http://superuser.com/a/315029
+
+function chpwd {
+ local SEARCH=' '
+ local REPLACE='%20'
+ local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
+ printf '\e]7;%s\a' "$PWD_URL"
+}
+
+chpwd \ No newline at end of file