2595484a97d85496fdcdca99a23f52eecd9b1b43

Author
Sébastien M-B <essembeh@gmail.com>
Committer
Sébastien M-B <essembeh@gmail.com>
Date

Message

Merge remote-tracking branch 'upstream/master'

Conflicts:
	lib/aliases.zsh

Diff

This diff is truncated to protect this page.

   1diff --git a/MIT-LICENSE.txt b/MIT-LICENSE.txt
   2new file mode 100644
   3index 0000000000000000000000000000000000000000..f6edab65be3f5703ec53770faf794d29a9aa1cd6
   4--- /dev/null
   5+++ b/MIT-LICENSE.txt
   6@@ -0,0 +1,21 @@
   7+The MIT License
   8+
   9+Copyright (c) 2009-2013 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors)
  10+
  11+Permission is hereby granted, free of charge, to any person obtaining a copy
  12+of this software and associated documentation files (the "Software"), to deal
  13+in the Software without restriction, including without limitation the rights
  14+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15+copies of the Software, and to permit persons to whom the Software is
  16+furnished to do so, subject to the following conditions:
  17+
  18+The above copyright notice and this permission notice shall be included in
  19+all copies or substantial portions of the Software.
  20+
  21+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  24+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  25+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  26+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  27+THE SOFTWARE.
  28diff --git a/README.textile b/README.textile
  29index a38e2d7cf83748f562590b4eb9383a827bc8d16f..0a4545bac277459e010242a976c097601d063979 100644
  30--- a/README.textile
  31+++ b/README.textile
  32@@ -26,17 +26,20 @@ h3. The manual way
  33 
  34   @git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@
  35 
  36-2. Create a new zsh config by copying the zsh template we've provided.
  37+2. *OPTIONAL* Backup your existing ~/.zshrc file
  38 
  39-  *NOTE*: If you already have a ~/.zshrc file, you should back it up. @cp ~/.zshrc ~/.zshrc.orig@ in case you want to go back to your original settings.
  40+  @cp ~/.zshrc ~/.zshrc.orig@
  41+
  42+3. Create a new zsh config by copying the zsh template we've provided.
  43 
  44   @cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc@
  45 
  46-3. Set zsh as your default shell:
  47+
  48+4. Set zsh as your default shell:
  49 
  50   @chsh -s /bin/zsh@
  51 
  52-4. Start / restart zsh (open a new terminal is easy enough...)
  53+5. Start / restart zsh (open a new terminal is easy enough...)
  54 
  55 h3. Problems?
  56 
  57diff --git a/lib/aliases.zsh b/lib/aliases.zsh
  58index d33d71cf076f96e0d3eb1c329ebfc38e852d5789..2b58c4faa857c6b352ec2adf8d79badb659f1821 100644
  59--- a/lib/aliases.zsh
  60+++ b/lib/aliases.zsh
  61@@ -8,6 +8,7 @@ alias -- -='cd -'
  62 
  63 # Super user
  64 alias _='sudo'
  65+alias please='sudo'
  66 
  67 #alias g='grep -in'
  68 
  69@@ -18,6 +19,7 @@ alias history='fc -l 1'
  70 alias lsa='ls -lah'
  71 #alias l='ls -la'
  72 alias ll='ls -l'
  73+alias la='ls -lA'
  74 alias sl=ls # often screw this up
  75 
  76 alias afind='ack-grep -il'
  77diff --git a/lib/completion.zsh b/lib/completion.zsh
  78index ce59d02fa0122e763a40d93044d9eec09ebc4bfc..e0cdcf626bfaf6250818f983e2bc954ec2fb6f53 100644
  79--- a/lib/completion.zsh
  80+++ b/lib/completion.zsh
  81@@ -32,7 +32,7 @@ zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-dir
  82 cdpath=(.)
  83 
  84 # use /etc/hosts and known_hosts for hostname completion
  85-[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
  86+[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _global_ssh_hosts=()
  87 [ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
  88 [ -r ~/.ssh/config ] && _ssh_config=($(cat ~/.ssh/config | sed -ne 's/Host[=\t ]//p')) || _ssh_config=()
  89 [ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
  90diff --git a/lib/directories.zsh b/lib/directories.zsh
  91index a787db9ebda2664163bebd1a42ce4727801eef61..6c743e40ec943bbe3f188e187752e584c3bfa2db 100644
  92--- a/lib/directories.zsh
  93+++ b/lib/directories.zsh
  94@@ -26,9 +26,9 @@ cd () {
  95   elif [[ "x$*" == "x...." ]]; then
  96     cd ../../..
  97   elif [[ "x$*" == "x....." ]]; then
  98-    cd ../../..
  99-  elif [[ "x$*" == "x......" ]]; then
 100     cd ../../../..
 101+  elif [[ "x$*" == "x......" ]]; then
 102+    cd ../../../../..
 103   else
 104     builtin cd "$@"
 105   fi
 106@@ -37,8 +37,3 @@ cd () {
 107 alias md='mkdir -p'
 108 alias rd=rmdir
 109 alias d='dirs -v | head -10'
 110-
 111-# mkdir & cd to it
 112-function mcd() { 
 113-  mkdir -p "$1" && cd "$1"; 
 114-}
 115diff --git a/lib/functions.zsh b/lib/functions.zsh
 116index d2dcadd0cb4d7235c8876556eb863140c315df12..63ab755cf72b1094975ef017cd71727c756e1943 100644
 117--- a/lib/functions.zsh
 118+++ b/lib/functions.zsh
 119@@ -1,5 +1,5 @@
 120 function zsh_stats() {
 121-  history | awk '{print $2}' | sort | uniq -c | sort -rn | head
 122+  history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl |  head -n20
 123 }
 124 
 125 function uninstall_oh_my_zsh() {
 126diff --git a/lib/git.zsh b/lib/git.zsh
 127index fb4ad8ca64ffbf7bcfd34ca82b1acbe8947d36bf..3e14695bd389f01265d8dcf90587a74f4767030c 100644
 128--- a/lib/git.zsh
 129+++ b/lib/git.zsh
 130@@ -1,6 +1,7 @@
 131 # get the name of the branch we are on
 132 function git_prompt_info() {
 133-  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
 134+  ref=$(git symbolic-ref HEAD 2> /dev/null) || \
 135+  ref=$(git rev-parse --short HEAD 2> /dev/null) || return
 136   echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
 137 }
 138 
 139@@ -8,16 +9,37 @@ function git_prompt_info() {
 140 # Checks if working tree is dirty
 141 parse_git_dirty() {
 142   local SUBMODULE_SYNTAX=''
 143-  if [[ $POST_1_7_2_GIT -gt 0 ]]; then
 144-        SUBMODULE_SYNTAX="--ignore-submodules=dirty"
 145-  fi
 146-  if [[ -n $(git status -s ${SUBMODULE_SYNTAX}  2> /dev/null) ]]; then
 147-    echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
 148-  else
 149-    echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
 150+  if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
 151+    if [[ $POST_1_7_2_GIT -gt 0 ]]; then
 152+          SUBMODULE_SYNTAX="--ignore-submodules=dirty"
 153+    fi
 154+    if [[ -n $(git status -s ${SUBMODULE_SYNTAX}  2> /dev/null) ]]; then
 155+      echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
 156+    else
 157+      echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
 158+    fi
 159   fi
 160 }
 161 
 162+# get the difference between the local and remote branches
 163+git_remote_status() {
 164+    remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
 165+    if [[ -n ${remote} ]] ; then
 166+        ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
 167+        behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
 168+
 169+        if [ $ahead -eq 0 ] && [ $behind -gt 0 ]
 170+        then
 171+            echo "$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
 172+        elif [ $ahead -gt 0 ] && [ $behind -eq 0 ]
 173+        then
 174+            echo "$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
 175+        elif [ $ahead -gt 0 ] && [ $behind -gt 0 ]
 176+        then
 177+            echo "$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
 178+        fi
 179+    fi
 180+}
 181 
 182 # Checks if there are commits ahead from remote
 183 function git_prompt_ahead() {
 184@@ -38,7 +60,7 @@ function git_prompt_long_sha() {
 185 
 186 # Get the status of the working tree
 187 git_prompt_status() {
 188-  INDEX=$(git status --porcelain 2> /dev/null)
 189+  INDEX=$(git status --porcelain -b 2> /dev/null)
 190   STATUS=""
 191   if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
 192     STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
 193@@ -60,18 +82,32 @@ git_prompt_status() {
 194   fi
 195   if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
 196     STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
 197+  elif $(echo "$INDEX" | grep '^D  ' &> /dev/null); then
 198+    STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
 199   elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
 200     STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
 201   fi
 202+  if $(git rev-parse --verify refs/stash >/dev/null 2>&1); then
 203+    STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS"
 204+  fi
 205   if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
 206     STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
 207   fi
 208+  if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then
 209+    STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS"
 210+  fi
 211+  if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then
 212+    STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS"
 213+  fi
 214+  if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then
 215+    STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS"
 216+  fi
 217   echo $STATUS
 218 }
 219 
 220 #compare the provided version of git to the version installed and on path
 221 #prints 1 if input version <= installed version
 222-#prints -1 otherwise 
 223+#prints -1 otherwise
 224 function git_compare_version() {
 225   local INPUT_GIT_VERSION=$1;
 226   local INSTALLED_GIT_VERSION
 227diff --git a/lib/misc.zsh b/lib/misc.zsh
 228index 0f7e7e9254959f01d6186c16f147764e9645e8b2..a8678b8ecd0185d66500e79bab39224676def2a6 100644
 229--- a/lib/misc.zsh
 230+++ b/lib/misc.zsh
 231@@ -9,5 +9,7 @@ bindkey "^[m" copy-prev-shell-word
 232 setopt long_list_jobs
 233 
 234 ## pager
 235-export PAGER="less -R"
 236+export PAGER="less"
 237+export LESS="-R"
 238+
 239 export LC_CTYPE=$LANG
 240diff --git a/lib/rvm.zsh b/lib/rvm.zsh
 241index 597be1b33b2076c267b202527909f6e896c099bd..e8744e61e373799201c3d55f4777f47be8728135 100644
 242--- a/lib/rvm.zsh
 243+++ b/lib/rvm.zsh
 244@@ -1,7 +1,8 @@
 245-# get the name of the branch we are on
 246+# get the name of the ruby version
 247 function rvm_prompt_info() {
 248-  ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) || return
 249-  echo "($ruby_version)"
 250+  [ -f $HOME/.rvm/bin/rvm-prompt ] || return
 251+  local rvm_prompt
 252+  rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
 253+  [[ "${rvm_prompt}x" == "x" ]] && return
 254+  echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}"
 255 }
 256-
 257-
 258diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
 259index e26fef6d30d8a3f46e1fa4862c20626815743891..c056989eb5a49df87a69f343362f11adb545acfb 100644
 260--- a/lib/termsupport.zsh
 261+++ b/lib/termsupport.zsh
 262@@ -26,8 +26,8 @@ function omz_termsupport_precmd {
 263 function omz_termsupport_preexec {
 264   emulate -L zsh
 265   setopt extended_glob
 266-  local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
 267-  title "$CMD" "%100>...>$2%<<"
 268+  local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
 269+  title "$CMD" "%100>...>${2:gs/%/%%}%<<"
 270 }
 271 
 272 autoload -U add-zsh-hook
 273diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
 274index ddef1ad6cf280b2c4ce53af32a77f8e493bab7fc..689a79feffe989472c5b4aa76117a746f4e696c8 100644
 275--- a/oh-my-zsh.sh
 276+++ b/oh-my-zsh.sh
 277@@ -11,7 +11,9 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
 278 
 279 # Load all of the config files in ~/oh-my-zsh that end in .zsh
 280 # TIP: Add files you don't want in git to .gitignore
 281-for config_file ($ZSH/lib/*.zsh) source $config_file
 282+for config_file ($ZSH/lib/*.zsh); do
 283+  source $config_file
 284+done
 285 
 286 # Set ZSH_CUSTOM to the path where your custom config files
 287 # and plugins exists, or else we will use the default custom/
 288@@ -51,7 +53,10 @@ for plugin ($plugins); do
 289 done
 290 
 291 # Load all of your custom configurations from custom/
 292-for config_file ($ZSH_CUSTOM/*.zsh(N)) source $config_file
 293+for config_file ($ZSH_CUSTOM/*.zsh(N)); do
 294+  source $config_file
 295+done
 296+unset config_file
 297 
 298 # Load the theme
 299 if [ "$ZSH_THEME" = "random" ]
 300diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh
 301index 294dc5354cce12627ab52e0d0d69f45ec9859131..ae92a0b4c5913ee7b7074f48b9cb283b5c437992 100644
 302--- a/plugins/archlinux/archlinux.plugin.zsh
 303+++ b/plugins/archlinux/archlinux.plugin.zsh
 304@@ -11,7 +11,7 @@ if [[ -x `which yaourt` ]]; then
 305   alias yaupg='yaourt -Syu'        # Synchronize with repositories before upgrading packages that are out of date on the local system.
 306   alias yasu='yaourt --sucre'      # Same as yaupg, but without confirmation
 307   alias yain='yaourt -S'           # Install specific package(s) from the repositories
 308-  alias yains='yaourt -U'          # Install specific package not from the repositories but from a file 
 309+  alias yains='yaourt -U'          # Install specific package not from the repositories but from a file
 310   alias yare='yaourt -R'           # Remove the specified package(s), retaining its configuration(s) and required dependencies
 311   alias yarem='yaourt -Rns'        # Remove the specified package(s), its configuration(s) and unneeded dependencies
 312   alias yarep='yaourt -Si'         # Display information about a given package in the repositories
 313@@ -35,7 +35,7 @@ fi
 314 # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
 315 alias pacupg='sudo pacman -Syu'        # Synchronize with repositories before upgrading packages that are out of date on the local system.
 316 alias pacin='sudo pacman -S'           # Install specific package(s) from the repositories
 317-alias pacins='sudo pacman -U'          # Install specific package not from the repositories but from a file 
 318+alias pacins='sudo pacman -U'          # Install specific package not from the repositories but from a file
 319 alias pacre='sudo pacman -R'           # Remove the specified package(s), retaining its configuration(s) and required dependencies
 320 alias pacrem='sudo pacman -Rns'        # Remove the specified package(s), its configuration(s) and unneeded dependencies
 321 alias pacrep='pacman -Si'              # Display information about a given package in the repositories
 322@@ -75,3 +75,19 @@ pacdisowned() {
 323 
 324   comm -23 "$fs" "$db"
 325 }
 326+
 327+pacmanallkeys() {
 328+  # Get all keys for developers and trusted users
 329+  curl https://www.archlinux.org/{developers,trustedusers}/ |
 330+  awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' |
 331+  xargs sudo pacman-key --recv-keys
 332+}
 333+
 334+pacmansignkeys() {
 335+  for key in $*; do
 336+    sudo pacman-key --recv-keys $key
 337+    sudo pacman-key --lsign-key $key
 338+    printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \
 339+      --no-permission-warning --command-fd 0 --edit-key $key
 340+  done
 341+}
 342diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
 343index 6f0edb062ac60bba4abc7b5fe84962ba286f8dee..3894ccd2f56c392f004327a5931b6b6a327b02b3 100644
 344--- a/plugins/autojump/autojump.plugin.zsh
 345+++ b/plugins/autojump/autojump.plugin.zsh
 346@@ -3,7 +3,11 @@ if [ $commands[autojump] ]; then # check if autojump is installed
 347     . /usr/share/autojump/autojump.zsh
 348   elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
 349     . /etc/profile.d/autojump.zsh
 350-  elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump ]; then # mac os x with brew
 351-    . `brew --prefix`/etc/autojump
 352+  elif [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
 353+    . $HOME/.autojump/etc/profile.d/autojump.zsh
 354+  elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
 355+    . /opt/local/etc/profile.d/autojump.zsh
 356+  elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew
 357+    . `brew --prefix`/etc/autojump.zsh
 358   fi
 359 fi
 360diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh
 361index bc75c5cf9ad01bd58ef29c4d83782ce5a849baff..95f8906321a948c4d0228c6ba0f580cd67556d73 100644
 362--- a/plugins/battery/battery.plugin.zsh
 363+++ b/plugins/battery/battery.plugin.zsh
 364@@ -1,20 +1,71 @@
 365-if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
 366-  function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" }
 367-  function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') }
 368-  function battery_pct_prompt() {
 369-    b=$(battery_pct_remaining)
 370-    if [ $b -gt 50 ] ; then
 371-      color='green'
 372-    elif [ $b -gt 20 ] ; then
 373-      color='yellow'
 374+###########################################
 375+# Battery plugin for oh-my-zsh            #
 376+# Original Author: Peter hoeg (peterhoeg) #
 377+# Email: peter@speartail.com              #
 378+###########################################
 379+# Author: Sean Jones (neuralsandwich)     #
 380+# Email: neuralsandwich@gmail.com         #
 381+# Modified to add support for Apple Mac   #
 382+###########################################
 383+
 384+if [[ $(uname) == "Darwin" ]] ; then
 385+
 386+  function battery_pct_remaining() {
 387+    if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
 388+      typeset -F maxcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
 389+      typeset -F currentcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //')
 390+      integer i=$(((currentcapacity/maxcapacity) * 100))
 391+      echo $i
 392     else
 393-      color='red'
 394+      echo "External Power"
 395     fi
 396-    echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
 397   }
 398-else
 399-  error_msg='no battery'
 400-  function battery_pct_remaining() { echo $error_msg }
 401-  function battery_time_remaining() { echo $error_msg }
 402-  function battery_pct_prompt() { echo '' }
 403+
 404+  function battery_time_remaining() {
 405+    if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
 406+      timeremaining=$(ioreg -rc "AppleSmartBattery"| grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
 407+      echo "~$((timeremaining / 60)):$((timeremaining % 60))"
 408+    else
 409+      echo "∞"
 410+    fi
 411+  }
 412+
 413+  function battery_pct_prompt () {
 414+    if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
 415+      b=$(battery_pct_remaining)
 416+      if [ $b -gt 50 ] ; then
 417+        color='green'
 418+      elif [ $b -gt 20 ] ; then
 419+        color='yellow'
 420+      else
 421+        color='red'
 422+      fi
 423+      echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
 424+    else
 425+      echo ""
 426+    fi
 427+  }
 428+
 429+elif [[ $(uname) == "Linux"  ]] ; then
 430+
 431+  if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
 432+    function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" }
 433+    function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') }
 434+    function battery_pct_prompt() {
 435+      b=$(battery_pct_remaining)
 436+      if [ $b -gt 50 ] ; then
 437+        color='green'
 438+      elif [ $b -gt 20 ] ; then
 439+        color='yellow'
 440+      else
 441+        color='red'
 442+      fi
 443+      echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
 444+    }
 445+  else
 446+    error_msg='no battery'
 447+    function battery_pct_remaining() { echo $error_msg }
 448+    function battery_time_remaining() { echo $error_msg }
 449+    function battery_pct_prompt() { echo '' }
 450+  fi
 451 fi
 452diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
 453index 1ca48089e17848c3fadaa76b23566b801bd19e24..10c221acd5bcc38cac0caf8a8b2cacfe7fe9fd9f 100644
 454--- a/plugins/bundler/bundler.plugin.zsh
 455+++ b/plugins/bundler/bundler.plugin.zsh
 456@@ -6,7 +6,7 @@ alias bu="bundle update"
 457 
 458 # The following is based on https://github.com/gma/bundler-exec
 459 
 460-bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rails rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails)
 461+bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma zeus)
 462 
 463 ## Functions
 464 
 465@@ -33,6 +33,7 @@ _run-with-bundler() {
 466 
 467 ## Main program
 468 for cmd in $bundled_commands; do
 469+  eval "function unbundled_$cmd () { $cmd \$@ }"
 470   eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}"
 471   alias $cmd=bundled_$cmd
 472 
 473diff --git a/plugins/bwana/bwana.plugin.zsh b/plugins/bwana/bwana.plugin.zsh
 474new file mode 100644
 475index 0000000000000000000000000000000000000000..455da862151d56f299dbd3923e09b28dc73895f0
 476--- /dev/null
 477+++ b/plugins/bwana/bwana.plugin.zsh
 478@@ -0,0 +1,13 @@
 479+#
 480+# Requires http://www.bruji.com/bwana/
 481+#
 482+if [[ -e /Applications/Bwana.app ]] ||
 483+    ( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana )
 484+then
 485+  function man() {
 486+    open "man:$1"
 487+  }
 488+else
 489+  echo "Bwana lets you read man files in Safari through a man: URI scheme" 
 490+  echo "To use it within Zsh, install it from http://www.bruji.com/bwana/"
 491+fi
 492diff --git a/plugins/cap/cap.plugin.zsh b/plugins/cap/cap.plugin.zsh
 493deleted file mode 100644
 494index 8336182d5d8692f609b04d0c9c9c385fc6de5367..0000000000000000000000000000000000000000
 495--- a/plugins/cap/cap.plugin.zsh
 496+++ /dev/null
 497@@ -1,21 +0,0 @@
 498-function _cap_does_task_list_need_generating () {
 499-  if [ ! -f .cap_tasks~ ]; then return 0;
 500-  else
 501-    accurate=$(stat -f%m .cap_tasks~)
 502-    changed=$(stat -f%m config/deploy.rb)
 503-    return $(expr $accurate '>=' $changed)
 504-  fi
 505-}
 506-
 507-function _cap () {
 508-  if [ -f config/deploy.rb ]; then
 509-    if _cap_does_task_list_need_generating; then
 510-      echo "\nGenerating .cap_tasks~..." > /dev/stderr
 511-      cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D'
 512-> .cap_tasks~
 513-    fi
 514-    compadd `cat .cap_tasks~`
 515-  fi
 516-}
 517-
 518-compctl -K _cap cap
 519diff --git a/plugins/capistrano/_capistrano b/plugins/capistrano/_capistrano
 520new file mode 100644
 521index 0000000000000000000000000000000000000000..cf6b50c7f9b62cd5d499352e5520cc43bcd9c2b5
 522--- /dev/null
 523+++ b/plugins/capistrano/_capistrano
 524@@ -0,0 +1,10 @@
 525+#compdef cap
 526+#autoload
 527+
 528+if [ -f config/deploy.rb ]; then
 529+  if [[ ! -f .cap_tasks~ || config/deploy.rb -nt .cap_tasks~ ]]; then
 530+    echo "\nGenerating .cap_tasks~..." > /dev/stderr
 531+    cap --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~
 532+  fi
 533+  compadd `cat .cap_tasks~`
 534+fi
 535diff --git a/plugins/coffee/_coffee b/plugins/coffee/_coffee
 536new file mode 100644
 537index 0000000000000000000000000000000000000000..5c8eb9a084050bf740c12992af8b609cb99a104c
 538--- /dev/null
 539+++ b/plugins/coffee/_coffee
 540@@ -0,0 +1,71 @@
 541+#compdef coffee
 542+# ------------------------------------------------------------------------------
 543+# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
 544+# All rights reserved.
 545+#
 546+# Redistribution and use in source and binary forms, with or without
 547+# modification, are permitted provided that the following conditions are met:
 548+#     * Redistributions of source code must retain the above copyright
 549+#       notice, this list of conditions and the following disclaimer.
 550+#     * Redistributions in binary form must reproduce the above copyright
 551+#       notice, this list of conditions and the following disclaimer in the
 552+#       documentation and/or other materials provided with the distribution.
 553+#     * Neither the name of the zsh-users nor the
 554+#       names of its contributors may be used to endorse or promote products
 555+#       derived from this software without specific prior written permission.
 556+#
 557+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 558+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 559+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 560+# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
 561+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 562+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 563+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 564+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 565+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 566+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 567+# ------------------------------------------------------------------------------
 568+# Description
 569+# -----------
 570+#
 571+#  Completion script for Coffee.js v0.6.11 (http://coffeejs.org)
 572+#
 573+# ------------------------------------------------------------------------------
 574+# Authors
 575+# -------
 576+#
 577+#  * Mario Fernandez (https://github.com/sirech)
 578+#
 579+# ------------------------------------------------------------------------------
 580+
 581+local curcontext="$curcontext" state line ret=1
 582+typeset -A opt_args
 583+
 584+_arguments -C \
 585+  '(- *)'{-h,--help}'[display this help message]' \
 586+  '(- *)'{-v,--version}'[display the version number]' \
 587+  '(-b --bare)'{-b,--bare}'[compile without a top-level function wrapper]' \
 588+  '(-e --eval)'{-e,--eval}'[pass a string from the command line as input]:Inline Script' \
 589+  '(-i --interactive)'{-i,--interactive}'[run an interactive CoffeeScript REPL]' \
 590+  '(-j --join)'{-j,--join}'[concatenate the source CoffeeScript before compiling]:Destination JS file:_files -g "*.js"' \
 591+  '(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]' \
 592+  '(--nodejs)--nodejs[pass options directly to the "node" binary]' \
 593+  '(-c --compile)'{-c,--compile}'[compile to JavaScript and save as .js files]' \
 594+  '(-o --output)'{-o,--output}'[set the output directory for compiled JavaScript]:Output Directory:_files -/' \
 595+  '(-n -t -p)'{-n,--nodes}'[print out the parse tree that the parser produces]' \
 596+  '(-n -t -p)'{-p,--print}'[print out the compiled JavaScript]' \
 597+  '(-n -t -p)'{-t,--tokens}'[print out the tokens that the lexer/rewriter produce]' \
 598+  '(-r --require)'{-r,--require}'[require a library before executing your script]:library' \
 599+  '(-s --stdio)'{-s,--stdio}'[listen for and compile scripts over stdio]' \
 600+  '(-w --watch)'{-w,--watch}'[watch scripts for changes and rerun commands]' \
 601+  '*:script or directory:_files' && ret=0
 602+
 603+return ret
 604+
 605+# Local Variables:
 606+# mode: Shell-Script
 607+# sh-indentation: 2
 608+# indent-tabs-mode: nil
 609+# sh-basic-offset: 2
 610+# End:
 611+# vim: ft=zsh sw=2 ts=2 et
 612diff --git a/plugins/colemak/colemak-less b/plugins/colemak/colemak-less
 613new file mode 100644
 614index 0000000000000000000000000000000000000000..e4ca4facd65707c1f2ada112fb8781664439e637
 615--- /dev/null
 616+++ b/plugins/colemak/colemak-less
 617@@ -0,0 +1,6 @@
 618+n    forw-line
 619+e    back-line
 620+k    repeat-search
 621+\ek  repeat-search-all
 622+K    reverse-search
 623+\eK  reverse-search-all
 624diff --git a/plugins/colemak/colemak.plugin.zsh b/plugins/colemak/colemak.plugin.zsh
 625new file mode 100644
 626index 0000000000000000000000000000000000000000..34d42c280423836a39582089b504d240718a3f35
 627--- /dev/null
 628+++ b/plugins/colemak/colemak.plugin.zsh
 629@@ -0,0 +1,22 @@
 630+# ctrl-j newline
 631+bindkey '^n' accept-line
 632+bindkey -a '^n' accept-line
 633+
 634+# another rotation to match qwerty
 635+bindkey -a 'n' down-line-or-history
 636+bindkey -a 'e' up-line-or-history
 637+bindkey -a 'i' vi-forward-char
 638+
 639+# make qwerty
 640+bindkey -a 'k' vi-repeat-search
 641+bindkey -a 'K' vi-rev-repeat-search
 642+bindkey -a 'u' vi-insert
 643+bindkey -a 'U' vi-insert-bol
 644+bindkey -a 'l' vi-undo-change
 645+bindkey -a 'N' vi-join
 646+
 647+# spare
 648+bindkey -a 'j' vi-forward-word-end
 649+bindkey -a 'J' vi-forward-blank-word-end
 650+
 651+lesskey $ZSH_CUSTOM/plugins/colemak/colemak-less
 652diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh
 653index 5ab03d5a9a57c3ff3f46a9ae881e6bb1643becbd..567da1b450014b4db7b5445bf564973b76c1afea 100644
 654--- a/plugins/command-not-found/command-not-found.plugin.zsh
 655+++ b/plugins/command-not-found/command-not-found.plugin.zsh
 656@@ -2,4 +2,4 @@
 657 # as seen in http://www.porcheron.info/command-not-found-for-zsh/
 658 # this is installed in Ubuntu
 659 
 660-source /etc/zsh_command_not_found
 661+[[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found
 662diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh
 663new file mode 100644
 664index 0000000000000000000000000000000000000000..c9b762d072ab2a3a0c7df36f76f91c6bc624da6b
 665--- /dev/null
 666+++ b/plugins/composer/composer.plugin.zsh
 667@@ -0,0 +1,29 @@
 668+# ------------------------------------------------------------------------------
 669+#          FILE:  composer.plugin.zsh
 670+#   DESCRIPTION:  oh-my-zsh composer plugin file.
 671+#        AUTHOR:  Daniel Gomes (me@danielcsgomes.com)
 672+#       VERSION:  1.0.0
 673+# ------------------------------------------------------------------------------
 674+
 675+# Composer basic command completion
 676+_composer_get_command_list () {
 677+	composer --no-ansi | sed "1,/Available commands/d" | awk '/^  [a-z]+/ { print $1 }'
 678+}
 679+
 680+_composer () {
 681+  if [ -f composer.json ]; then
 682+    compadd `_composer_get_command_list`
 683+  fi
 684+}
 685+
 686+compdef _composer composer
 687+
 688+# Aliases
 689+alias c='composer'
 690+alias csu='composer self-update'
 691+alias cu='composer update'
 692+alias ci='composer install'
 693+alias ccp='composer create-project'
 694+
 695+# install composer in the current directory
 696+alias cget='curl -s https://getcomposer.org/installer | php'
 697diff --git a/plugins/cp/cp.plugin.zsh b/plugins/cp/cp.plugin.zsh
 698new file mode 100644
 699index 0000000000000000000000000000000000000000..7355a99902792ba5875256322da3997b3e348760
 700--- /dev/null
 701+++ b/plugins/cp/cp.plugin.zsh
 702@@ -0,0 +1,14 @@
 703+#Show progress while file is copying
 704+
 705+# Rsync options are:
 706+#  -p - preserve permissions
 707+#  -o - preserve owner
 708+#  -g - preserve group
 709+#  -h - output in human-readable format
 710+#  --progress - display progress
 711+#  -b - instead of just overwriting an existing file, save the original
 712+#  --backup-dir=/tmp/rsync - move backup copies to "/tmp/rsync"
 713+#  -e /dev/null - only work on local files
 714+#  -- - everything after this is an argument, even if it looks like an option
 715+
 716+alias cpv="rsync -poghb --backup-dir=/tmp/rsync -e /dev/null --progress --"
 717diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
 718index 39d3ef36a05280e9e285412afecba861278bd73c..55b90e3793a3bc1f13cf43f7c1c0e74eb84062cc 100644
 719--- a/plugins/debian/debian.plugin.zsh
 720+++ b/plugins/debian/debian.plugin.zsh
 721@@ -6,14 +6,14 @@
 722 
 723 # Use aptitude if installed, or apt-get if not.
 724 # You can just set apt_pref='apt-get' to override it.
 725-if [[ -e $( which aptitude ) ]]; then
 726+if [[ -e $( which aptitude 2>&1 ) ]]; then
 727     apt_pref='aptitude'
 728 else
 729     apt_pref='apt-get'
 730 fi
 731 
 732 # Use sudo by default if it's installed
 733-if [[ -e $( which sudo ) ]]; then
 734+if [[ -e $( which sudo 2>&1 ) ]]; then
 735     use_sudo=1
 736 fi
 737 
 738@@ -21,7 +21,7 @@ fi
 739 # These are for more obscure uses of apt-get and aptitude that aren't covered
 740 # below.
 741 alias ag='apt-get'
 742-alias at='aptitude'
 743+alias ap='aptitude'
 744 
 745 # Some self-explanatory aliases
 746 alias acs="apt-cache search"
 747@@ -35,7 +35,7 @@ alias afs='apt-file search --regexp'
 748 
 749 # These are apt-get only
 750 alias asrc='apt-get source'
 751-alias ap='apt-cache policy'
 752+alias app='apt-cache policy'
 753 
 754 # superuser operations ######################################################
 755 if [[ $use_sudo -eq 1 ]]; then
 756@@ -61,7 +61,8 @@ if [[ $use_sudo -eq 1 ]]; then
 757     # Install all .deb files in the current directory.
 758     # Warning: you will need to put the glob in single quotes if you use:
 759     # glob_subst
 760-    alias di='sudo dpkg -i ./*.deb'
 761+    alias dia='sudo dpkg -i ./*.deb'
 762+    alias di='sudo dpkg -i'
 763 
 764     # Remove ALL kernel images and headers EXCEPT the one in use
 765     alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
 766@@ -100,7 +101,8 @@ else
 767 
 768     # Install all .deb files in the current directory
 769     # Assumes glob_subst is off
 770-    alias di='su -lc "dpkg -i ./*.deb" root'
 771+    alias dia='su -lc "dpkg -i ./*.deb" root'
 772+    alias di='su -lc "dpkg -i" root'
 773 
 774     # Remove ALL kernel images and headers EXCEPT the one in use
 775     alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) \
 776diff --git a/plugins/encode64/encode64.plugin.zsh b/plugins/encode64/encode64.plugin.zsh
 777index cfb7c6a18305c7b67507743b3b0977f4b4b3a047..3b59447c5b4cf2bea3f25bbd37698ca595768f91 100644
 778--- a/plugins/encode64/encode64.plugin.zsh
 779+++ b/plugins/encode64/encode64.plugin.zsh
 780@@ -1,2 +1,4 @@
 781 encode64(){ echo -n $1 | base64 }
 782-decode64(){ echo -n $1 | base64 -D }
 783+decode64(){ echo -n $1 | base64 -D }
 784+alias e64=encode64
 785+alias d64=decode64
 786diff --git a/plugins/fasd/fasd.plugin.zsh b/plugins/fasd/fasd.plugin.zsh
 787new file mode 100644
 788index 0000000000000000000000000000000000000000..d42584f1a49b6236f2104fd8e54837e678a10a01
 789--- /dev/null
 790+++ b/plugins/fasd/fasd.plugin.zsh
 791@@ -0,0 +1,6 @@
 792+if [ $commands[fasd] ]; then # check if fasd is installed
 793+  eval "$(fasd --init auto)"
 794+  alias v='f -e vim'
 795+  alias o='a -e open'
 796+fi
 797+
 798diff --git a/plugins/forklift/forklift.plugin.zsh b/plugins/forklift/forklift.plugin.zsh
 799new file mode 100644
 800index 0000000000000000000000000000000000000000..056069d36211daa345cf245105fbfe1ee104c993
 801--- /dev/null
 802+++ b/plugins/forklift/forklift.plugin.zsh
 803@@ -0,0 +1,44 @@
 804+# Open folder in ForkLift.app from console
 805+# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
 806+#
 807+# Usage:
 808+#   fl [<folder>]
 809+#
 810+# Opens specified directory or current working directory in ForkLift.app
 811+#
 812+# Notes:
 813+# It assumes Shift+Cmd+G launches go to folder panel and Cmd+N opens new
 814+# app window.
 815+#
 816+# https://gist.github.com/3313481
 817+function fl {
 818+  if [ ! -z "$1" ]; then
 819+    DIR=$1
 820+    if [ ! -d "$DIR" ]; then
 821+      DIR=$(dirname $DIR)
 822+    fi
 823+    if [ "$DIR" != "." ]; then
 824+      PWD=`cd "$DIR";pwd`
 825+    fi
 826+  fi
 827+  osascript 2>&1 1>/dev/null <<END
 828+    tell application "ForkLift"
 829+      activate
 830+    end tell
 831+    tell application "System Events"
 832+      tell application process "ForkLift"
 833+        try
 834+          set topWindow to window 1
 835+        on error
 836+          keystroke "n" using command down
 837+          set topWindow to window 1
 838+        end try
 839+        keystroke "g" using {command down, shift down}
 840+        tell sheet 1 of topWindow
 841+          set value of text field 1 to "$PWD"
 842+        	keystroke return
 843+        end tell
 844+      end tell
 845+    end tell
 846+END
 847+}
 848diff --git a/plugins/git-extras/git-extras.plugin.zsh b/plugins/git-extras/git-extras.plugin.zsh
 849new file mode 100644
 850index 0000000000000000000000000000000000000000..8419166abc10b7f05a30fe02d39aa34d3c33cddb
 851--- /dev/null
 852+++ b/plugins/git-extras/git-extras.plugin.zsh
 853@@ -0,0 +1,285 @@
 854+#compdef git
 855+# ------------------------------------------------------------------------------
 856+# Description
 857+# -----------
 858+#
 859+#  Completion script for git-extras (http://github.com/visionmedia/git-extras).
 860+#
 861+# ------------------------------------------------------------------------------
 862+# Authors
 863+# -------
 864+#
 865+#  * Alexis GRIMALDI (https://github.com/agrimaldi)
 866+#
 867+# ------------------------------------------------------------------------------
 868+# Inspirations
 869+# -----------
 870+#
 871+#  * git-extras (http://github.com/visionmedia/git-extras)
 872+#  * git-flow-completion (http://github.com/bobthecow/git-flow-completion)
 873+#
 874+# ------------------------------------------------------------------------------
 875+
 876+
 877+__git_command_successful () {
 878+    if (( ${#pipestatus:#0} > 0 )); then
 879+        _message 'not a git repository'
 880+        return 1
 881+    fi
 882+    return 0
 883+}
 884+
 885+
 886+__git_tag_names() {
 887+    local expl
 888+    declare -a tag_names
 889+    tag_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
 890+    __git_command_successful || return
 891+    _wanted tag-names expl tag-name compadd $* - $tag_names
 892+}
 893+
 894+
 895+__git_branch_names() {
 896+    local expl
 897+    declare -a branch_names
 898+    branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
 899+    __git_command_successful || return
 900+    _wanted branch-names expl branch-name compadd $* - $branch_names
 901+}
 902+
 903+
 904+__git_feature_branch_names() {
 905+    local expl
 906+    declare -a branch_names
 907+    branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/feature 2>/dev/null)"}#refs/heads/feature/})
 908+    __git_command_successful || return
 909+    _wanted branch-names expl branch-name compadd $* - $branch_names
 910+}
 911+
 912+
 913+__git_refactor_branch_names() {
 914+    local expl
 915+    declare -a branch_names
 916+    branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/refactor 2>/dev/null)"}#refs/heads/refactor/})
 917+    __git_command_successful || return
 918+    _wanted branch-names expl branch-name compadd $* - $branch_names
 919+}
 920+
 921+
 922+__git_bug_branch_names() {
 923+    local expl
 924+    declare -a branch_names
 925+    branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/bug 2>/dev/null)"}#refs/heads/bug/})
 926+    __git_command_successful || return
 927+    _wanted branch-names expl branch-name compadd $* - $branch_names
 928+}
 929+
 930+
 931+__git_submodule_names() {
 932+    local expl
 933+    declare -a submodule_names
 934+    submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"})
 935+    __git_command_successful || return
 936+    _wanted submodule-names expl submodule-name compadd $* - $submodule_names
 937+}
 938+
 939+
 940+__git_author_names() {
 941+    local expl
 942+    declare -a author_names
 943+    author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"})
 944+    __git_command_successful || return
 945+    _wanted author-names expl author-name compadd $* - $author_names
 946+}
 947+
 948+
 949+_git-changelog() {
 950+    _arguments \
 951+        '(-l --list)'{-l,--list}'[list commits]' \
 952+}
 953diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh
 954index 71b343884a5428660c92ce86ca63823d4337f8c7..ec21019e65c24ad21351dba73044952f687434e8 100644
 955--- a/plugins/git-flow/git-flow.plugin.zsh
 956+++ b/plugins/git-flow/git-flow.plugin.zsh
 957@@ -195,7 +195,7 @@ __git-flow-feature ()
 958 				'start:Start a new feature branch.'
 959 				'finish:Finish a feature branch.'
 960 				'list:List all your feature branches. (Alias to `git flow feature`)'
 961-				'publish: public'
 962+				'publish: publish'
 963 				'track: track'
 964 				'diff: diff'
 965 				'rebase: rebase'
 966@@ -221,6 +221,7 @@ __git-flow-feature ()
 967 					_arguments \
 968 						-F'[Fetch from origin before performing finish]' \
 969 						-r'[Rebase instead of merge]'\
 970+						-k'[Keep branch after performing finish]'\
 971 						':feature:__git_flow_feature_list'
 972 				;;
 973 
 974@@ -236,13 +237,13 @@ __git-flow-feature ()
 975 
 976 				(diff)
 977 					_arguments \
 978-						':branch:__git_branch_names'\
 979+						':branch:__git_flow_feature_list'\
 980 				;;
 981 
 982 				(rebase)
 983 					_arguments \
 984 						-i'[Do an interactive rebase]' \
 985-						':branch:__git_branch_names'
 986+						':branch:__git_flow_feature_list'
 987 				;;
 988 
 989 				(checkout)
 990@@ -253,7 +254,7 @@ __git-flow-feature ()
 991 				(pull)
 992 					_arguments \
 993 						':remote:__git_remotes'\
 994-						':branch:__git_branch_names'
 995+						':branch:__git_flow_feature_list'
 996 				;;
 997 
 998 				*)
 999@@ -333,4 +334,4 @@ __git_command_successful () {
1000 	return 0
1001 }
1002 
1003-zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'
1004+zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'
1005diff --git a/plugins/git-hubflow/git-hubflow.plugin.zsh b/plugins/git-hubflow/git-hubflow.plugin.zsh
1006new file mode 100644
1007index 0000000000000000000000000000000000000000..a09f88391778e6af32ab4329aa53542a90f2ae80
1008--- /dev/null
1009+++ b/plugins/git-hubflow/git-hubflow.plugin.zsh
1010@@ -0,0 +1,348 @@
1011+#!zsh
1012+#
1013+# Installation
1014+# ------------
1015+#
1016+# To achieve git-hubflow completion nirvana:
1017+#
1018+#  0. Update your zsh's git-completion module to the newest verion.
1019+#     From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
1020+#
1021+#  1. Install this file. Either:
1022+#
1023+#     a. Place it in your .zshrc:
1024+#
1025+#     b. Or, copy it somewhere (e.g. ~/.git-hubflow-completion.zsh) and put the following line in
1026+#        your .zshrc:
1027+#
1028+#            source ~/.git-hubflow-completion.zsh
1029+#
1030+#     c. Or, use this file as a oh-my-zsh plugin.
1031+#
1032+
1033+_git-hf ()
1034+{
1035+    local curcontext="$curcontext" state line
1036+    typeset -A opt_args
1037+
1038+    _arguments -C \
1039+        ':command:->command' \
1040+        '*::options:->options'
1041+
1042+    case $state in
1043+        (command)
1044+
1045+            local -a subcommands
1046+            subcommands=(
1047+                'init:Initialize a new git repo with support for the branching model.'
1048+                'feature:Manage your feature branches.'
1049+                'release:Manage your release branches.'
1050+                'hotfix:Manage your hotfix branches.'
1051+                'support:Manage your support branches.'
1052+                'update:Pull upstream changes down into your master and develop branches.'
1053+                'version:Shows version information.'
1054+            )
1055+            _describe -t commands 'git hf' subcommands
1056+        ;;
1057+
1058+        (options)
1059+            case $line[1] in
1060+
1061+                (init)
1062+                    _arguments \
1063+                        -f'[Force setting of gitflow branches, even if already configured]'
1064+                ;;
1065+
1066+                (version)
1067+                ;;
1068+
1069+                (hotfix)
1070+                    __git-hf-hotfix
1071+                ;;
1072+
1073+                (release)
1074+                    __git-hf-release
1075+                ;;
1076+
1077+                (feature)
1078+                    __git-hf-feature
1079+                ;;
1080+            esac
1081+        ;;
1082+    esac
1083+}
1084+
1085+__git-hf-release ()
1086+{
1087+    local curcontext="$curcontext" state line
1088+    typeset -A opt_args
1089+
1090+    _arguments -C \
1091+        ':command:->command' \
1092+        '*::options:->options'
1093+
1094+    case $state in
1095+        (command)
1096+
1097+            local -a subcommands
1098+            subcommands=(
1099+                'start:Start a new release branch.'
1100+                'finish:Finish a release branch.'
1101+                'list:List all your release branches. (Alias to `git hf release`)'
1102+                'cancel:Cancel release'
1103+                'push:Push release to github'
1104+                'pull:Pull release from github'
1105+                'track:Track release'
1106+            )
1107+            _describe -t commands 'git hf release' subcommands
1108+            _arguments \
1109+                -v'[Verbose (more) output]'
1110diff --git a/plugins/git-remote-branch/git-remote-branch.plugin.zsh b/plugins/git-remote-branch/git-remote-branch.plugin.zsh
1111new file mode 100644
1112index 0000000000000000000000000000000000000000..ff98cbf87a296045abbff56082dfeae839f79dbf
1113--- /dev/null
1114+++ b/plugins/git-remote-branch/git-remote-branch.plugin.zsh
1115@@ -0,0 +1,18 @@
1116+_git_remote_branch() {
1117+  ref=$(git symbolic-ref HEAD 2> /dev/null)
1118+  if [[ -n $ref ]]; then
1119+    if (( CURRENT == 2 )); then
1120+      # first arg: operation
1121+      compadd create publish rename delete track
1122+    elif (( CURRENT == 3 )); then
1123+      # second arg: remote branch name
1124+      compadd `git branch -r | grep -v HEAD | sed "s/.*\///" | sed "s/ //g"`
1125+    elif (( CURRENT == 4 )); then
1126+      # third arg: remote name
1127+      compadd `git remote`
1128+    fi
1129+  else;
1130+    _files
1131+  fi
1132+}
1133+compdef _git_remote_branch grb
1134diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
1135index d3d3f702a362c6ebe24109369da2e6d1a8652464..154aa6db1a4d686c65be2c4931c40eaac4d6bd8d 100644
1136--- a/plugins/git/git.plugin.zsh
1137+++ b/plugins/git/git.plugin.zsh
1138@@ -5,10 +5,11 @@ alias gst='git status'
1139 compdef _git gst=git-status
1140 alias gl='git pull'
1141 compdef _git gl=git-pull
1142-alias gup='git fetch && git rebase'
1143+alias gup='git pull --rebase'
1144 compdef _git gup=git-fetch
1145 alias gp='git push'
1146 compdef _git gp=git-push
1147+alias gd='git diff'
1148 gdv() { git diff -w "$@" | view - }
1149 compdef _git gdv=git-diff
1150 alias gc='git commit -v'
1151@@ -18,18 +19,33 @@ compdef _git gca=git-commit
1152 alias gco='git checkout'
1153 compdef _git gco=git-checkout
1154 alias gcm='git checkout master'
1155+alias gr='git remote'
1156+compdef _git gr=git-remote
1157+alias grv='git remote -v'
1158+compdef _git grv=git-remote
1159+alias grmv='git remote rename'
1160+compdef _git grmv=git-remote
1161+alias grrm='git remote remove'
1162+compdef _git grrm=git-remote
1163+alias grset='git remote set-url'
1164+compdef _git grset=git-remote
1165+alias grup='git remote update'
1166+compdef _git grset=git-remote
1167 alias gb='git branch'
1168 compdef _git gb=git-branch
1169 alias gba='git branch -a'
1170 compdef _git gba=git-branch
1171 alias gcount='git shortlog -sn'
1172 compdef gcount=git
1173+alias gcl='git config --list'
1174 alias gcp='git cherry-pick'
1175 compdef _git gcp=git-cherry-pick
1176 alias glg='git log --stat --max-count=5'
1177 compdef _git glg=git-log
1178 alias glgg='git log --graph --max-count=5'
1179 compdef _git glgg=git-log
1180+alias glgga='git log --graph --decorate --all'
1181+compdef _git glgga=git-log
1182 alias gss='git status -s'
1183 compdef _git gss=git-status
1184 alias ga='git add'
1185@@ -38,6 +54,13 @@ alias gm='git merge'
1186 compdef _git gm=git-merge
1187 alias grh='git reset HEAD'
1188 alias grhh='git reset HEAD --hard'
1189+alias gwc='git whatchanged -p --abbrev-commit --pretty=medium'
1190+alias gf='git ls-files | grep'
1191+alias gpoat='git push origin --all && git push origin --tags'
1192+
1193+# Will cd into the top of the current repository
1194+# or submodule.
1195+alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
1196 
1197 # Git and svn mix
1198 alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
1199@@ -50,13 +73,14 @@ alias gsd='git svn dcommit'
1200 # Usage example: git pull origin $(current_branch)
1201 #
1202 function current_branch() {
1203-  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
1204+  ref=$(git symbolic-ref HEAD 2> /dev/null) || \
1205+  ref=$(git rev-parse --short HEAD 2> /dev/null) || return
1206   echo ${ref#refs/heads/}
1207 }
1208 
1209 function current_repository() {
1210-
1211-  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
1212+  ref=$(git symbolic-ref HEAD 2> /dev/null) || \
1213+  ref=$(git rev-parse --short HEAD 2> /dev/null) || return
1214   echo $(git remote -v | cut -d':' -f 2)
1215 }
1216 
1217diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git
1218new file mode 100644
1219index 0000000000000000000000000000000000000000..45775021fff11011a98b90a6b8ebaa72d3d0cd9f
1220--- /dev/null
1221+++ b/plugins/gitfast/_git
1222@@ -0,0 +1,78 @@
1223+#compdef git gitk
1224+
1225+# zsh completion wrapper for git
1226+#
1227+# You need git's bash completion script installed somewhere, by default on the
1228+# same directory as this script.
1229+#
1230+# If your script is on ~/.git-completion.sh instead, you can configure it on
1231+# your ~/.zshrc:
1232+#
1233+#  zstyle ':completion:*:*:git:*' script ~/.git-completion.sh
1234+#
1235+# The recommended way to install this script is to copy to
1236+# '~/.zsh/completion/_git', and then add the following to your ~/.zshrc file:
1237+#
1238+#  fpath=(~/.zsh/completion $fpath)
1239+
1240+complete ()
1241+{
1242+	# do nothing
1243+	return 0
1244+}
1245+
1246+zstyle -s ":completion:*:*:git:*" script script
1247+test -z "$script" && script="$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash
1248+ZSH_VERSION='' . "$script"
1249+
1250+__gitcomp ()
1251+{
1252+	emulate -L zsh
1253+
1254+	local cur_="${3-$cur}"
1255+
1256+	case "$cur_" in
1257+	--*=)
1258+		;;
1259+	*)
1260+		local c IFS=$' \t\n'
1261+		local -a array
1262+		for c in ${=1}; do
1263+			c="$c${4-}"
1264+			case $c in
1265+			--*=*|*.) ;;
1266+			*) c="$c " ;;
1267+			esac
1268+			array+=("$c")
1269+		done
1270+		compset -P '*[=:]'
1271+		compadd -Q -S '' -p "${2-}" -a -- array && _ret=0
1272+		;;
1273+	esac
1274+}
1275+
1276+__gitcomp_nl ()
1277+{
1278+	emulate -L zsh
1279+
1280+	local IFS=$'\n'
1281+	compset -P '*[=:]'
1282+	compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
1283+}
1284+
1285+_git ()
1286+{
1287+	local _ret=1
1288+	() {
1289+		emulate -L ksh
1290+		local cur cword prev
1291+		cur=${words[CURRENT-1]}
1292+		prev=${words[CURRENT-2]}
1293+		let cword=CURRENT-1
1294+		__${service}_main
1295+	}
1296+	let _ret && _default -S '' && _ret=0
1297+	return _ret
1298+}
1299+
1300+_git
1301diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash
1302new file mode 100644
1303index 0000000000000000000000000000000000000000..be800e09bdf0656951c415105e0d32ce0b0edf9e
1304--- /dev/null
1305+++ b/plugins/gitfast/git-completion.bash
1306@@ -0,0 +1,2483 @@
1307+#!bash
1308+#
1309+# bash/zsh completion support for core Git.
1310+#
1311+# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
1312+# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
1313+# Distributed under the GNU General Public License, version 2.0.
1314+#
1315+# The contained completion routines provide support for completing:
1316+#
1317+#    *) local and remote branch names
1318+#    *) local and remote tag names
1319+#    *) .git/remotes file names
1320+#    *) git 'subcommands'
1321+#    *) tree paths within 'ref:path/to/file' expressions
1322+#    *) common --long-options
1323+#
1324+# To use these routines:
1325+#
1326+#    1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
1327+#    2) Add the following line to your .bashrc/.zshrc:
1328+#        source ~/.git-completion.sh
1329+#    3) Consider changing your PS1 to also show the current branch,
1330+#       see git-prompt.sh for details.
1331+
1332+if [[ -n ${ZSH_VERSION-} ]]; then
1333+	autoload -U +X bashcompinit && bashcompinit
1334+fi
1335+
1336+case "$COMP_WORDBREAKS" in
1337+*:*) : great ;;
1338+*)   COMP_WORDBREAKS="$COMP_WORDBREAKS:"
1339+esac
1340+
1341+# __gitdir accepts 0 or 1 arguments (i.e., location)
1342+# returns location of .git repo
1343+__gitdir ()
1344+{
1345+	# Note: this function is duplicated in git-prompt.sh
1346+	# When updating it, make sure you update the other one to match.
1347+	if [ -z "${1-}" ]; then
1348+		if [ -n "${__git_dir-}" ]; then
1349+			echo "$__git_dir"
1350+		elif [ -n "${GIT_DIR-}" ]; then
1351+			test -d "${GIT_DIR-}" || return 1
1352+			echo "$GIT_DIR"
1353+		elif [ -d .git ]; then
1354+			echo .git
1355+		else
1356+			git rev-parse --git-dir 2>/dev/null
1357+		fi
1358+	elif [ -d "$1/.git" ]; then
1359+		echo "$1/.git"
1360+	else
1361+		echo "$1"
1362+	fi
1363+}
1364+
1365+__gitcomp_1 ()
1366+{
1367+	local c IFS=$' \t\n'
1368+	for c in $1; do
1369+		c="$c$2"
1370+		case $c in
1371+		--*=*|*.) ;;
1372+		*) c="$c " ;;
1373+		esac
1374+		printf '%s\n' "$c"
1375+	done
1376+}
1377+
1378+# The following function is based on code from:
1379+#
1380+#   bash_completion - programmable completion functions for bash 3.2+
1381+#
1382+#   Copyright © 2006-2008, Ian Macdonald <ian@caliban.org>
1383+#             © 2009-2010, Bash Completion Maintainers
1384+#                     <bash-completion-devel@lists.alioth.debian.org>
1385+#
1386+#   This program is free software; you can redistribute it and/or modify
1387+#   it under the terms of the GNU General Public License as published by
1388+#   the Free Software Foundation; either version 2, or (at your option)
1389+#   any later version.
1390+#
1391+#   This program is distributed in the hope that it will be useful,
1392+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
1393+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1394+#   GNU General Public License for more details.
1395+#
1396+#   You should have received a copy of the GNU General Public License
1397+#   along with this program; if not, write to the Free Software Foundation,
1398+#   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1399+#
1400+#   The latest version of this software can be obtained here:
1401+#
1402+#   http://bash-completion.alioth.debian.org/
1403+#
1404+#   RELEASE: 2.x
1405+
1406diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh
1407new file mode 100644
1408index 0000000000000000000000000000000000000000..bf20491ec33e467f6b9591d94a2e27bc9e3d93e9
1409--- /dev/null
1410+++ b/plugins/gitfast/git-prompt.sh
1411@@ -0,0 +1,290 @@
1412+# bash/zsh git prompt support
1413+#
1414+# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
1415+# Distributed under the GNU General Public License, version 2.0.
1416+#
1417+# This script allows you to see the current branch in your prompt.
1418+#
1419+# To enable:
1420+#
1421+#    1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
1422+#    2) Add the following line to your .bashrc/.zshrc:
1423+#        source ~/.git-prompt.sh
1424+#    3) Change your PS1 to also show the current branch:
1425+#         Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
1426+#         ZSH:  PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ '
1427+#
1428+# The argument to __git_ps1 will be displayed only if you are currently
1429+# in a git repository.  The %s token will be the name of the current
1430+# branch.
1431+#
1432+# In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty value,
1433+# unstaged (*) and staged (+) changes will be shown next to the branch
1434+# name.  You can configure this per-repository with the
1435+# bash.showDirtyState variable, which defaults to true once
1436+# GIT_PS1_SHOWDIRTYSTATE is enabled.
1437+#
1438+# You can also see if currently something is stashed, by setting
1439+# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
1440+# then a '$' will be shown next to the branch name.
1441+#
1442+# If you would like to see if there're untracked files, then you can set
1443+# GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked
1444+# files, then a '%' will be shown next to the branch name.
1445+#
1446+# If you would like to see the difference between HEAD and its upstream,
1447+# set GIT_PS1_SHOWUPSTREAM="auto".  A "<" indicates you are behind, ">"
1448+# indicates you are ahead, "<>" indicates you have diverged and "="
1449+# indicates that there is no difference. You can further control
1450+# behaviour by setting GIT_PS1_SHOWUPSTREAM to a space-separated list
1451+# of values:
1452+#
1453+#     verbose       show number of commits ahead/behind (+/-) upstream
1454+#     legacy        don't use the '--count' option available in recent
1455+#                   versions of git-rev-list
1456+#     git           always compare HEAD to @{upstream}
1457+#     svn           always compare HEAD to your SVN upstream
1458+#
1459+# By default, __git_ps1 will compare HEAD to your SVN upstream if it can
1460+# find one, or @{upstream} otherwise.  Once you have set
1461+# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
1462+# setting the bash.showUpstream config variable.
1463+
1464+# __gitdir accepts 0 or 1 arguments (i.e., location)
1465+# returns location of .git repo
1466+__gitdir ()
1467+{
1468+	# Note: this function is duplicated in git-completion.bash
1469+	# When updating it, make sure you update the other one to match.
1470+	if [ -z "${1-}" ]; then
1471+		if [ -n "${__git_dir-}" ]; then
1472+			echo "$__git_dir"
1473+		elif [ -n "${GIT_DIR-}" ]; then
1474+			test -d "${GIT_DIR-}" || return 1
1475+			echo "$GIT_DIR"
1476+		elif [ -d .git ]; then
1477+			echo .git
1478+		else
1479+			git rev-parse --git-dir 2>/dev/null
1480+		fi
1481+	elif [ -d "$1/.git" ]; then
1482+		echo "$1/.git"
1483+	else
1484+		echo "$1"
1485+	fi
1486+}
1487+
1488+# stores the divergence from upstream in $p
1489+# used by GIT_PS1_SHOWUPSTREAM
1490+__git_ps1_show_upstream ()
1491+{
1492+	local key value
1493+	local svn_remote svn_url_pattern count n
1494+	local upstream=git legacy="" verbose=""
1495+
1496+	svn_remote=()
1497+	# get some config options from git-config
1498+	local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
1499+	while read -r key value; do
1500+		case "$key" in
1501+		bash.showupstream)
1502+			GIT_PS1_SHOWUPSTREAM="$value"
1503+			if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then
1504+				p=""
1505+				return
1506+			fi
1507+			;;
1508+		svn-remote.*.url)
1509+			svn_remote[ $((${#svn_remote[@]} + 1)) ]="$value"
1510+			svn_url_pattern+="\\|$value"
1511diff --git a/plugins/gitfast/gitfast.plugin.zsh b/plugins/gitfast/gitfast.plugin.zsh
1512new file mode 100644
1513index 0000000000000000000000000000000000000000..7e50cf721cb33e5f090379cb43b2c53950a17902
1514--- /dev/null
1515+++ b/plugins/gitfast/gitfast.plugin.zsh
1516@@ -0,0 +1,7 @@
1517+dir=$(dirname $0)
1518+source $dir/../git/git.plugin.zsh
1519+source $dir/git-prompt.sh
1520+
1521+function git_prompt_info() {
1522+  __git_ps1 "${ZSH_THEME_GIT_PROMPT_PREFIX//\%/%%}%s${ZSH_THEME_GIT_PROMPT_SUFFIX//\%/%%}"
1523+}
1524diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh
1525index 197e86a48743419f79cceb8f4d4ebdafca0a5972..598b059c18753f0f76002a2e93046f037c1c9e56 100644
1526--- a/plugins/github/github.plugin.zsh
1527+++ b/plugins/github/github.plugin.zsh
1528@@ -61,6 +61,7 @@ exist_gh() { # [DIRECTORY]
1529     cd "$1"
1530     name=$( git config user.name )
1531     ghuser=$( git config github.user )
1532+    repo=$1
1533 
1534     git remote add origin git@github.com:${ghuser}/${repo}.git
1535     git push -u origin master
1536diff --git a/plugins/heroku/_heroku b/plugins/heroku/_heroku
1537index dc899e2b2a3e07b6d36501b4b1b6f4f6211302db..a95c38647f9bde735428d46db379f331fcf62113 100644
1538--- a/plugins/heroku/_heroku
1539+++ b/plugins/heroku/_heroku
1540@@ -154,5 +154,6 @@ case "$words[1]" in
1541 _arguments \
1542   $_command_args \
1543   '(--app)--app[the app name]' \
1544+  '(--remote)--remote[the remote name]' \
1545   &&  return 0
1546 
1547diff --git a/plugins/history/history.plugin.zsh b/plugins/history/history.plugin.zsh
1548new file mode 100644
1549index 0000000000000000000000000000000000000000..0f4aa4b10720d359d48cbac77c86234bf26f56a3
1550--- /dev/null
1551+++ b/plugins/history/history.plugin.zsh
1552@@ -0,0 +1,8 @@
1553+alias h='history'
1554+
1555+function hs
1556+{
1557+    history | grep $*
1558+}
1559+
1560+alias hsi='hs -i'
1561diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
1562new file mode 100644
1563index 0000000000000000000000000000000000000000..b91f93c9565620f53094880cef5bc0469ab3250f
1564--- /dev/null
1565+++ b/plugins/jira/jira.plugin.zsh
1566@@ -0,0 +1,38 @@
1567+# To use: add a .jira-url file in the base of your project
1568+#         You can also set JIRA_URL in your .zshrc or put .jira-url in your home directory
1569+#         .jira-url in the current directory takes precedence
1570+#
1571+# If you use Rapid Board, set:
1572+#JIRA_RAPID_BOARD="yes"
1573+# in you .zshrc
1574+#
1575+# Setup: cd to/my/project
1576+#        echo "https://name.jira.com" >> .jira-url
1577+# Usage: jira           # opens a new issue
1578+#        jira ABC-123   # Opens an existing issue
1579+open_jira_issue () {
1580+  if [ -f .jira-url ]; then
1581+    jira_url=$(cat .jira-url)
1582+  elif [ -f ~/.jira-url ]; then
1583+    jira_url=$(cat ~/.jira-url)
1584+  elif [[ "x$JIRA_URL" != "x" ]]; then
1585+    jira_url=$JIRA_URL
1586+  else
1587+    echo "JIRA url is not specified anywhere."
1588+    return 0
1589+  fi
1590+
1591+  if [ -z "$1" ]; then
1592+    echo "Opening new issue"
1593+    `open $jira_url/secure/CreateIssue!default.jspa`
1594+  else
1595+    echo "Opening issue #$1"
1596+    if [[ "x$JIRA_RAPID_BOARD" = "yes" ]]; then
1597+      `open $jira_url/issues/$1`
1598+    else
1599+      `open $jira_url/browse/$1`
1600+    fi
1601+  fi
1602+}
1603+
1604+alias jira='open_jira_issue'
1605diff --git a/plugins/knife/_knife b/plugins/knife/_knife
1606index 8453af5be60abb5412a28010dc500f7fb1512cc9..dec49125786e5dd40b04d092f540cc07e2ce57b3 100644
1607--- a/plugins/knife/_knife
1608+++ b/plugins/knife/_knife
1609@@ -170,7 +170,11 @@ _chef_environments_remote() {
1610 
1611 # The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
1612 _chef_cookbooks_local() {
1613- (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)
1614+ local knife_rb="$HOME/.chef/knife.rb"
1615+ if [ -f ./.chef/knife.rb ]; then
1616+  knife_rb="./.chef/knife.rb"
1617+ fi
1618+ (for i in $( grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
1619 }
1620 
1621 # This function extracts the available cookbook versions on the chef server
1622diff --git a/plugins/laravel/_artisan b/plugins/laravel/_artisan
1623new file mode 100644
1624index 0000000000000000000000000000000000000000..8637514cfe97ccf0ce40d208b46c68ebbb8f86bb
1625--- /dev/null
1626+++ b/plugins/laravel/_artisan
1627@@ -0,0 +1,40 @@
1628+#compdef artisan
1629+
1630+# Laravel autocompletion
1631+# Author: John Hamelink <john@johnhamelink.com>
1632+#
1633+# This plugin does the following:
1634+#  - Adds aliases and autocompletion for artisan
1635+#  - Adds aliases and autocompletion for bob
1636+
1637+local curcontext="$curcontext" state line _opts _bundles ret=1
1638+_arguments -C \
1639+    '1: :->cmds' \
1640+    '*:: :->args' && ret=0
1641+
1642+case $state in
1643+    cmds)
1644+
1645+    _values "Artisan command" \
1646+        'session\:install[Create a session table]' \
1647+        'migrate[Manage Migrations]' \
1648+        'test[Run a test]' \
1649+        'route\:\:call[Call a route in the CLI]' \
1650+        'key\:\:generate[Generate a key]'
1651+        ret=0
1652+        ;;
1653+    args)
1654+        case $line[1] in
1655+            migrate)
1656+                _values \
1657+                    'install[Create the Laravel migration table' \
1658+                    'make[Create a migration]' \
1659+                    'rollback[Roll back to the last migration operation]' \
1660+                    'reset[Roll back all migrations that have ever run]'
1661+                ret=0
1662+                ;;
1663+        esac
1664+        ;;
1665+esac
1666+
1667+return ret
1668diff --git a/plugins/laravel/laravel.plugin.zsh b/plugins/laravel/laravel.plugin.zsh
1669new file mode 100644
1670index 0000000000000000000000000000000000000000..ed932ee89fae5965f74bdad6cd65a18cfa696640
1671--- /dev/null
1672+++ b/plugins/laravel/laravel.plugin.zsh
1673@@ -0,0 +1,3 @@
1674+#!zsh
1675+alias artisan='php artisan'
1676+alias bob='php artisan bob::build'
1677diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh
1678new file mode 100644
1679index 0000000000000000000000000000000000000000..190bc279d505cc9c985023f10a12ee694dbd3067
1680--- /dev/null
1681+++ b/plugins/last-working-dir/last-working-dir.plugin.zsh
1682@@ -0,0 +1,24 @@
1683+#!/usr/bin/env zsh
1684+# Keeps track of the last used working directory and automatically jumps
1685+# into it for new shells.
1686+
1687+# Flag indicating if we've previously jumped to last directory.
1688+typeset -g ZSH_LAST_WORKING_DIRECTORY
1689+mkdir -p "$ZSH/cache"
1690+local cache_file="$ZSH/cache/last-working-dir"
1691+
1692+# Updates the last directory once directory is changed.
1693+function chpwd() {
1694+	echo "$PWD" > "$cache_file"
1695+}
1696+
1697+# Changes directory to the last working directory.
1698+function lwd() {
1699+	[[ ! -r "$cache_file" ]] || cd `cat "$cache_file"`
1700+}
1701+
1702+# Automatically jump to last working directory unless this isn't the first time
1703+# this plugin has been loaded.
1704+if [[ -z "$ZSH_LAST_WORKING_DIRECTORY" ]]; then
1705+	lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true
1706+fi
1707diff --git a/plugins/lein/lein.plugin.zsh b/plugins/lein/lein.plugin.zsh
1708index 19af3556a662b89a55a6b00e022a8018953cddd3..11c92979bb727cd40ed89ea551c92ce58474dcbf 100644
1709--- a/plugins/lein/lein.plugin.zsh
1710+++ b/plugins/lein/lein.plugin.zsh
1711@@ -5,15 +5,29 @@ function _lein_commands() {
1712     case $state in
1713       subcommand)
1714         subcommands=(
1715+          "classpath:print the classpath of the current project"
1716           "clean:remove compiled files and dependencies from project"
1717           "compile:ahead-of-time compile the project"
1718+          "deploy:build jar and deploy to remote repository"
1719           "deps:download and install all dependencies"
1720           "help:display a list of tasks or help for a given task"
1721           "install:install the project and its dependencies in your local repository"
1722+          "int:enter an interactive task shell"
1723+          "interactive:enter an interactive task shell"
1724+          "jack-in:jack in to a clojure slime session from emacs."
1725           "jar:create a jar file containing the compiled .class files"
1726+          "javac:compile java source files"
1727           "new:create a new project skeleton"
1728+          "plugin:manage user-level plugins"
1729           "pom:write a pom.xml file to disk for maven interop"
1730+          "repl:start a repl session either with the current project or standalone"
1731+          "retest:run only the test namespaces which failed last time around"
1732+          "run:run the project's -main function"
1733+          "search:search remote maven repositories for matching jars"
1734+          "swank:launch swank server for Emacs to connect"
1735           "test:run the project's tests"
1736+          "test!:run a project's tests after cleaning and fetching dependencies"
1737+          "trampoline:run a task without nesting the project's JVM inside Leiningen's."
1738           "uberjar:Create a jar including the contents of each of deps"
1739           "upgrade:upgrade leiningen to the latest stable release"
1740           "version:print leiningen's version"
1741diff --git a/plugins/lol/lol.plugin.zsh b/plugins/lol/lol.plugin.zsh
1742index e455527e7617fb356c9e73dc5271f7c75bb71ff6..ae065c12f8066f2197af9f24b879c0101e519cb5 100644
1743--- a/plugins/lol/lol.plugin.zsh
1744+++ b/plugins/lol/lol.plugin.zsh
1745@@ -5,6 +5,7 @@ alias wtf='dmesg'
1746 alias onoz='cat /var/log/errors.log'
1747 alias rtfm='man'
1748 
1749+alias :3='echo'
1750 alias visible='echo'
1751 alias invisible='cat'
1752 alias moar='more'
1753@@ -29,7 +30,7 @@ alias iminurbase='finger'
1754 alias btw='nice'
1755 alias obtw='nohup'
1756 
1757-alias nomz='ps -aux'
1758+alias nomz='ps aux'
1759 alias nomnom='killall'
1760 
1761 alias byes='exit'
1762diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh
1763index caf0d9efc81196a73e9b8592fd3a0a3b0f46ed17..a3a6ff8b65e42b49b9e59e5cb56c8b49f9563456 100644
1764--- a/plugins/mercurial/mercurial.plugin.zsh
1765+++ b/plugins/mercurial/mercurial.plugin.zsh
1766@@ -12,3 +12,9 @@ alias hgp='hg push'
1767 alias hgs='hg status'
1768 # this is the 'git commit --amend' equivalent
1769 alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
1770+
1771+function hg_current_branch() {
1772+  if [ -d .hg ]; then
1773+    echo hg:$(hg branch)
1774+  fi
1775+}
1776diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
1777index e8af2f49d5d2f87daeae99b23d59fecdc7b44d26..da29b4f0abaf50ffa5c315d1ebcfdf032a21b0ae 100644
1778--- a/plugins/mvn/mvn.plugin.zsh
1779+++ b/plugins/mvn/mvn.plugin.zsh
1780@@ -1,6 +1,170 @@
1781+# mvn-color based on https://gist.github.com/1027800
1782+export BOLD=`tput bold`
1783+export UNDERLINE_ON=`tput smul`
1784+export UNDERLINE_OFF=`tput rmul`
1785+export TEXT_BLACK=`tput setaf 0`
1786+export TEXT_RED=`tput setaf 1`
1787+export TEXT_GREEN=`tput setaf 2`
1788+export TEXT_YELLOW=`tput setaf 3`
1789+export TEXT_BLUE=`tput setaf 4`
1790+export TEXT_MAGENTA=`tput setaf 5`
1791+export TEXT_CYAN=`tput setaf 6`
1792+export TEXT_WHITE=`tput setaf 7`
1793+export BACKGROUND_BLACK=`tput setab 0`
1794+export BACKGROUND_RED=`tput setab 1`
1795+export BACKGROUND_GREEN=`tput setab 2`
1796+export BACKGROUND_YELLOW=`tput setab 3`
1797+export BACKGROUND_BLUE=`tput setab 4`
1798+export BACKGROUND_MAGENTA=`tput setab 5`
1799+export BACKGROUND_CYAN=`tput setab 6`
1800+export BACKGROUND_WHITE=`tput setab 7`
1801+export RESET_FORMATTING=`tput sgr0`
1802+
1803+ 
1804+# Wrapper function for Maven's mvn command.
1805+mvn-color()
1806+{
1807+  # Filter mvn output using sed
1808+  mvn $@ | sed -e "s/\(\[INFO\]\ \-.*\)/${TEXT_BLUE}${BOLD}\1/g" \
1809+               -e "s/\(\[INFO\]\ \[.*\)/${RESET_FORMATTING}${BOLD}\1${RESET_FORMATTING}/g" \
1810+               -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \
1811+               -e "s/\(\[WARNING\].*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}/g" \
1812+               -e "s/\(\[ERROR\].*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}/g" \
1813diff --git a/plugins/nanoc/_nanoc b/plugins/nanoc/_nanoc
1814new file mode 100644
1815index 0000000000000000000000000000000000000000..fde07c3fccc5c8faae39916f8a7dd9e5edc43afe
1816--- /dev/null
1817+++ b/plugins/nanoc/_nanoc
1818@@ -0,0 +1,44 @@
1819+#compdef nanoc
1820+#autoload
1821+
1822+# nanoc zsh completion - based on the homebrew zsh completion
1823+# requires the 'nanoc' gem to be installed
1824+
1825+local -a _1st_arguments
1826+_1st_arguments=(
1827+  'autocompile:start the autocompiler'
1828+  'compile:compile items of this site'
1829+  'create-item:create an item'
1830+  'create-layout:create a layout'
1831+  'create-site:create a site'
1832+  'deploy:deploy the compiled site'
1833+  'help:show help'
1834+  'prune:remove files not managed by nanoc from the output directory'
1835+  'show-data:show data in this site'
1836+  'show-plugins:show all available plugins'
1837+  'show-rules:describe the rules for each item'
1838+  'update:update the data stored by the data source to a newer version'
1839+  'validate-css:validate the site’s CSS'
1840+  'validate-html:validate the site’s HTML'
1841+  'validate-links:validate links in site'
1842+  'view:start the web server that serves static files'
1843+  'watch:start the watcher'
1844+)
1845+
1846+local expl
1847+local -a pkgs installed_pkgs
1848+
1849+_arguments \
1850+  '(--color)--color[enable color]' \
1851+  '(--debug)--debug[enable debugging]' \
1852+  '(--help)--help[show the help message and quit]' \
1853+  '(--no-color)--no-color[disable color]' \
1854+  '(--verbose)--verbose[make nanoc output more detailed]' \
1855+  '(--version)--version[show version information and quit]' \
1856+  '(--warn)--warn[enable warnings]' \
1857+  '*:: :->subcmds' && return 0
1858+
1859+if (( CURRENT == 1 )); then
1860+  _describe -t commands "nanoc subcommand" _1st_arguments
1861+  return
1862+fi