0ba398f9e1aaf05e72406d5c840f013eebb6b260

Author
James Smith <james@loopj.com>
Committer
James Smith <james@loopj.com>
Date

Message

Merge in recent stuff

Diff

This diff is truncated to protect this page.

   1diff --git a/.gitignore b/.gitignore
   2index 8d19d100c593afe9d4524f55b84c4b6c45eafbbd..2e8db7341894fdf0940c0c37995e93e1b3b0d9fa 100644
   3--- a/.gitignore
   4+++ b/.gitignore
   5@@ -2,4 +2,7 @@ locals.zsh
   6 log/.zsh_history
   7 projects.zsh
   8 custom/*
   9-!custom/example.zsh
  10+!custom/example
  11+!custom/example.zsh
  12+cache
  13+*.swp
  14diff --git a/README.textile b/README.textile
  15index 0659aded875b3ff85cb695560d8fe9bbc3e1d4c1..2dbfbe5a658d8bba2d387bbab272e189ab9e8fca 100644
  16--- a/README.textile
  17+++ b/README.textile
  18@@ -8,7 +8,7 @@ h2. Setup
  19 
  20 h3. The automatic installer... (do you trust me?)
  21 
  22-@wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
  23+@wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
  24 
  25 h3. The manual way
  26 
  27@@ -48,22 +48,26 @@ the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty fo
  28 h3. Customization
  29 
  30 If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory.
  31-If you have many functions which go good together you can put them as a *.plugin.zsh file in the @plugin/@ directory and then enable this plugin.
  32+If you have many functions which go good together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin.
  33+If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@.
  34+
  35 
  36 h3. Uninstalling
  37 
  38 If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config).
  39 
  40-h2. Thanks
  41-
  42-* Rick Olson (technoweenie) might remember some of the configuration, which I took from a pastie a few years ago.
  43-* Marcel (noradio) provided Rick the original zsh configuration.
  44-* Nicholas (ulysses) for the "rake autocompletion code":http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh.
  45-
  46 h2. Help out!
  47 
  48 I'm far from being a zsh-expert and suspect there are many ways to improve. If you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
  49 
  50 h3. Send us your theme!
  51 
  52-I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory.
  53+I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory.
  54+
  55+h2. Contributors
  56+
  57+This project wouldn't exist without all of our awesome users and contributors.
  58+
  59+* "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors
  60+
  61+Thank you so much!
  62diff --git a/custom/example/example.plugin.zsh b/custom/example/example.plugin.zsh
  63new file mode 100644
  64index 0000000000000000000000000000000000000000..406f27445b76feced2ff33e2d09b079f6739eca3
  65--- /dev/null
  66+++ b/custom/example/example.plugin.zsh
  67@@ -0,0 +1,2 @@
  68+# Add your own custom plugins in the custom/plugins directory. Plugins placed
  69+# here will override ones with the same name in the main plugins directory.
  70diff --git a/lib/aliases.zsh b/lib/aliases.zsh
  71index b47de5bde5a573e4c9465048111c133b3213edc3..0555be2642fcd73e6d4ced8bc44e7eee75e13607 100644
  72--- a/lib/aliases.zsh
  73+++ b/lib/aliases.zsh
  74@@ -22,4 +22,3 @@ alias sl=ls # often screw this up
  75 
  76 alias afind='ack-grep -il'
  77 
  78-alias x=extract
  79diff --git a/lib/completion.zsh b/lib/completion.zsh
  80index e8e9776a5b9f7e70e51bc8421d8080c9d637d793..fdd0a8536cd4825235d0f4fddd217f0f398ea86b 100644
  81--- a/lib/completion.zsh
  82+++ b/lib/completion.zsh
  83@@ -4,14 +4,10 @@ unsetopt menu_complete   # do not autoselect the first completion entry
  84 unsetopt flowcontrol
  85 setopt auto_menu         # show completion menu on succesive tab press
  86 setopt complete_in_word
  87-setopt complete_aliases
  88 setopt always_to_end
  89 
  90 WORDCHARS=''
  91 
  92-autoload -U compinit
  93-compinit -i
  94-
  95 zmodload -i zsh/complist
  96 
  97 ## case-insensitive (all),partial-word and then substring completion
  98diff --git a/lib/edit-command-line.zsh b/lib/edit-command-line.zsh
  99new file mode 100644
 100index 0000000000000000000000000000000000000000..db2000325c82691b5eef2b664c27b00caab1ec58
 101--- /dev/null
 102+++ b/lib/edit-command-line.zsh
 103@@ -0,0 +1,3 @@
 104+autoload -U edit-command-line
 105+zle -N edit-command-line
 106+bindkey '\C-x\C-e' edit-command-line
 107diff --git a/lib/functions.zsh b/lib/functions.zsh
 108index 6f5d015f7a598739ddc3de8e5fbf451817a8e125..ef7cc6383038b7e6f9a02c857f13ea498ba5a8fe 100644
 109--- a/lib/functions.zsh
 110+++ b/lib/functions.zsh
 111@@ -15,38 +15,3 @@ function take() {
 112   cd $1
 113 }
 114 
 115-function extract() {
 116-    unset REMOVE_ARCHIVE
 117-    
 118-    if test "$1" = "-r"; then
 119-        REMOVE=1
 120-        shift
 121-    fi
 122-  if [[ -f $1 ]]; then
 123-    case $1 in
 124-      *.tar.bz2) tar xvjf $1;;
 125-      *.tar.gz) tar xvzf $1;;
 126-      *.tar.xz) tar xvJf $1;;
 127-      *.tar.lzma) tar --lzma -xvf $1;;
 128-      *.bz2) bunzip $1;;
 129-      *.rar) unrar $1;;
 130-      *.gz) gunzip $1;;
 131-      *.tar) tar xvf $1;;
 132-      *.tbz2) tar xvjf $1;;
 133-      *.tgz) tar xvzf $1;;
 134-      *.zip) unzip $1;;
 135-      *.Z) uncompress $1;;
 136-      *.7z) 7z x $1;;
 137-      *) echo "'$1' cannot be extracted via >extract<";;
 138-    esac
 139-
 140-    if [[ $REMOVE_ARCHIVE -eq 1 ]]; then
 141-        echo removing "$1";
 142-        /bin/rm "$1";
 143-    fi
 144-
 145-  else
 146-    echo "'$1' is not a valid file"
 147-  fi
 148-}
 149-
 150diff --git a/lib/git.zsh b/lib/git.zsh
 151index 75367f8777f475c32ebb9f77354ba51c36e1c452..010cb2a1c8c3c5fcb909b564a0154d3ad8f4c1d0 100644
 152--- a/lib/git.zsh
 153+++ b/lib/git.zsh
 154@@ -4,8 +4,8 @@ function git_prompt_info() {
 155   echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
 156 }
 157 
 158-# get dirty status of the current working tree
 159-parse_git_dirty () {
 160+# Checks if working tree is dirty
 161+parse_git_dirty() {
 162   if [[ -n $(git status -s 2> /dev/null) ]]; then
 163     echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
 164   else
 165@@ -33,7 +33,24 @@ git_remote_status() {
 166     fi
 167 }
 168 
 169-# get the status of the working tree
 170+# Checks if there are commits ahead from remote
 171+function git_prompt_ahead() {
 172+  if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
 173+    echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
 174+  fi
 175+}
 176+
 177+# Formats prompt string for current git commit short SHA
 178+function git_prompt_short_sha() {
 179+  SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
 180+}
 181+
 182+# Formats prompt string for current git commit long SHA
 183+function git_prompt_long_sha() {
 184+  SHA=$(git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
 185+}
 186+
 187+# Get the status of the working tree
 188 git_prompt_status() {
 189   INDEX=$(git status --porcelain 2> /dev/null)
 190   STATUS=""
 191@@ -57,6 +74,8 @@ git_prompt_status() {
 192   fi
 193   if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
 194     STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
 195+  elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
 196+    STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
 197   fi
 198   if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
 199     STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
 200diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh
 201index 7196a88ffe3de7e8b1f4e8327ed58f050f8898b8..9c2dda35a2aa9f2dbb0b4c644bc80142549c3172 100644
 202--- a/lib/key-bindings.zsh
 203+++ b/lib/key-bindings.zsh
 204@@ -1,6 +1,4 @@
 205 # TODO: Explain what some of this does..
 206-autoload -U compinit
 207-compinit -i
 208 
 209 bindkey -e
 210 bindkey '\ew' kill-region
 211@@ -22,6 +20,12 @@ bindkey ' ' magic-space    # also do history expansion on space
 212 
 213 bindkey '^[[Z' reverse-menu-complete
 214 
 215+# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
 216+bindkey '^?' backward-delete-char
 217+bindkey "^[[3~" delete-char
 218+bindkey "^[3;5~" delete-char
 219+bindkey "\e[3~" delete-char
 220+
 221 # consider emacs keybindings:
 222 
 223 #bindkey -e  ## emacs key bindings
 224diff --git a/lib/misc.zsh b/lib/misc.zsh
 225index 4c1743657fc1f70a3de0b2ca37fa7c0df7b05843..88732e664e1fc4ec3c5cb8e8e04ccc2ba9761dba 100644
 226--- a/lib/misc.zsh
 227+++ b/lib/misc.zsh
 228@@ -10,4 +10,4 @@ setopt long_list_jobs
 229 
 230 ## pager
 231 export PAGER=less
 232-export LC_CTYPE=en_US.UTF-8
 233+export LC_CTYPE=$LANG
 234diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh
 235index 4006a7fe105dd0b7fddadf8b265186b57f596cc6..2fdf537ef5e2ea10e1494f4668c01231ba58e1e2 100644
 236--- a/lib/spectrum.zsh
 237+++ b/lib/spectrum.zsh
 238@@ -18,3 +18,11 @@ for color in {000..255}; do
 239     FG[$color]="%{[38;5;${color}m%}"
 240     BG[$color]="%{[48;5;${color}m%}"
 241 done
 242+
 243+# Show all 256 colors with color number
 244+function spectrum_ls() {
 245+  for code in {000..255}; do
 246+    print -P -- "$code: %F{$code}Test%f"
 247+  done
 248+}
 249+
 250diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
 251index e1e536690be580eb0c99a1df47ad5b3df9494073..22e7f372fffdb1da78ffd3852130340a5d9aa448 100644
 252--- a/lib/termsupport.zsh
 253+++ b/lib/termsupport.zsh
 254@@ -3,11 +3,12 @@
 255 #Fully support screen, iterm, and probably most modern xterm and rxvt
 256 #Limited support for Apple Terminal (Terminal can't set window or tab separately)
 257 function title {
 258-  if [[ "$TERM" == "screen" ]]; then 
 259-    print -Pn "\ek$1\e\\" #set screen hardstatus, usually truncated at 20 chars
 260-  elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
 261-    print -Pn "\e]2;$2\a" #set window name
 262-    print -Pn "\e]1;$1\a" #set icon (=tab) name (will override window name on broken terminal)
 263+  [ "$DISABLE_AUTO_TITLE" != "true" ] || return
 264+  if [[ "$TERM" == screen* ]]; then 
 265+    print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
 266+  elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
 267+    print -Pn "\e]2;$2:q\a" #set window name
 268+    print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
 269   fi
 270 }
 271 
 272@@ -21,6 +22,8 @@ function precmd {
 273 
 274 #Appears at the beginning of (and during) of command execution
 275 function preexec {
 276+  emulate -L zsh
 277+  setopt extended_glob
 278   local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
 279   title "$CMD" "%100>...>$2%<<"
 280 }
 281diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
 282index 291772dfe0b8bc5345717ef2b185eb7b52fa3194..c4522491bc083f1cade6207432a4f4e62c6d009c 100644
 283--- a/oh-my-zsh.sh
 284+++ b/oh-my-zsh.sh
 285@@ -1,26 +1,51 @@
 286+# Check for updates on initial load...
 287+if [ "$DISABLE_AUTO_UPDATE" != "true" ]
 288+then
 289+  /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh
 290+fi
 291+
 292 # Initializes Oh My Zsh
 293 
 294 # add a function path
 295-fpath=($ZSH/functions $fpath)
 296+fpath=($ZSH/functions $ZSH/completions $fpath)
 297 
 298 # Load all of the config files in ~/oh-my-zsh that end in .zsh
 299 # TIP: Add files you don't want in git to .gitignore
 300 for config_file ($ZSH/lib/*.zsh) source $config_file
 301 
 302-# Load all of your custom configurations from custom/
 303-for config_file ($ZSH/custom/*.zsh) source $config_file
 304+# Add all defined plugins to fpath
 305+plugin=${plugin:=()}
 306+for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath)
 307+
 308+# Load and run compinit
 309+autoload -U compinit
 310+compinit -i
 311 
 312 # Load all of the plugins that were defined in ~/.zshrc
 313-plugin=${plugin:=()}
 314-for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh
 315+for plugin ($plugins); do
 316+  if [ -f $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh ]; then
 317+    source $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh
 318+  elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
 319+    source $ZSH/plugins/$plugin/$plugin.plugin.zsh
 320+  fi
 321+done
 322 
 323-# Load the theme
 324-source "$ZSH/themes/$ZSH_THEME.zsh-theme"
 325+# Load all of your custom configurations from custom/
 326+for config_file ($ZSH/custom/*.zsh) source $config_file
 327 
 328-# Check for updates on initial load...
 329-if [ "$DISABLE_AUTO_UPDATE" = "true" ]
 330+# Load the theme
 331+if [ "$ZSH_THEME" = "random" ]
 332 then
 333-  return
 334+  themes=($ZSH/themes/*zsh-theme)
 335+  N=${#themes[@]}
 336+  ((N=(RANDOM%N)+1))
 337+  RANDOM_THEME=${themes[$N]}
 338+  source "$RANDOM_THEME"
 339+  echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
 340 else
 341-  /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh
 342+  if [ ! "$ZSH_THEME" = ""  ]
 343+  then
 344+    source "$ZSH/themes/$ZSH_THEME.zsh-theme"
 345+  fi
 346 fi
 347+
 348diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh
 349new file mode 100644
 350index 0000000000000000000000000000000000000000..691d4d2db51a09b5ce69c83d621f8e2cce008e28
 351--- /dev/null
 352+++ b/plugins/ant/ant.plugin.zsh
 353@@ -0,0 +1,26 @@
 354+stat -f%m . > /dev/null 2>&1
 355+if [ "$?" = 0 ]; then
 356+	stat_cmd=(stat -f%m)
 357+else
 358+	stat_cmd=(stat -L --format=%Y)
 359+fi
 360+
 361+_ant_does_target_list_need_generating () {
 362+  if [ ! -f .ant_targets ]; then return 0;
 363+  else
 364+    accurate=$($stat_cmd .ant_targets)
 365+    changed=$($stat_cmd build.xml)
 366+    return $(expr $accurate '>=' $changed)
 367+  fi
 368+}
 369+
 370+_ant () {
 371+  if [ -f build.xml ]; then
 372+    if _ant_does_target_list_need_generating; then
 373+     sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets
 374+    fi
 375+    compadd `cat .ant_targets`
 376+  fi
 377+}
 378+
 379+compdef _ant ant
 380diff --git a/plugins/apache2-macports/apache2-macports.plugin.zsh b/plugins/apache2-macports/apache2-macports.plugin.zsh
 381new file mode 100644
 382index 0000000000000000000000000000000000000000..1caa4cf9d11b318a59a7c5473c975c5c5833d103
 383--- /dev/null
 384+++ b/plugins/apache2-macports/apache2-macports.plugin.zsh
 385@@ -0,0 +1,6 @@
 386+# commands to control local apache2 server installation
 387+# paths are for osx installation via macports
 388+
 389+alias apache2start='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start'
 390+alias apache2stop='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop'
 391+alias apache2restart='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart'
 392diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh
 393new file mode 100644
 394index 0000000000000000000000000000000000000000..b5e519036229b856c7a92854130d7fccaf848957
 395--- /dev/null
 396+++ b/plugins/archlinux/archlinux.plugin.zsh
 397@@ -0,0 +1,76 @@
 398+# Archlinux zsh aliases and functions
 399+# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
 400+
 401+# Look for yaourt, and add some useful functions if we have it.
 402+if [[ -x `which yaourt` ]]; then
 403+  upgrade () {
 404+    yaourt -Syu
 405+  }
 406+  alias yaconf='yaourt -C'        # Fix all configuration files with vimdiff
 407+  # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
 408+  alias yaupg='yaourt -Syu'        # Synchronize with repositories before upgrading packages that are out of date on the local system.
 409+  alias yain='yaourt -S'           # Install specific package(s) from the repositories
 410+  alias yains='yaourt -U'          # Install specific package not from the repositories but from a file 
 411+  alias yare='yaourt -R'           # Remove the specified package(s), retaining its configuration(s) and required dependencies
 412+  alias yarem='yaourt -Rns'        # Remove the specified package(s), its configuration(s) and unneeded dependencies
 413+  alias yarep='yaourt -Si'         # Display information about a given package in the repositories
 414+  alias yareps='yaourt -Ss'        # Search for package(s) in the repositories
 415+  alias yaloc='yaourt -Qi'         # Display information about a given package in the local database
 416+  alias yalocs='yaourt -Qs'        # Search for package(s) in the local database
 417+  # Additional yaourt alias examples
 418+  if [[ -x `which abs` ]]; then
 419+    alias yaupd='yaourt -Sy && sudo abs'   # Update and refresh the local package and ABS databases against repositories
 420+  else
 421+    alias yaupd='yaourt -Sy'               # Update and refresh the local package and ABS databases against repositories
 422+  fi
 423+  alias yainsd='yaourt -S --asdeps'        # Install given package(s) as dependencies of another package
 424+  alias yamir='yaourt -Syy'                # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
 425+else
 426+ upgrade() {
 427+   sudo pacman -Syu
 428+ }
 429+fi
 430+
 431+# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
 432+alias pacupg='sudo pacman -Syu'        # Synchronize with repositories before upgrading packages that are out of date on the local system.
 433+alias pacin='sudo pacman -S'           # Install specific package(s) from the repositories
 434+alias pacins='sudo pacman -U'          # Install specific package not from the repositories but from a file 
 435+alias pacre='sudo pacman -R'           # Remove the specified package(s), retaining its configuration(s) and required dependencies
 436+alias pacrem='sudo pacman -Rns'        # Remove the specified package(s), its configuration(s) and unneeded dependencies
 437+alias pacrep='pacman -Si'              # Display information about a given package in the repositories
 438+alias pacreps='pacman -Ss'             # Search for package(s) in the repositories
 439+alias pacloc='pacman -Qi'              # Display information about a given package in the local database
 440+alias paclocs='pacman -Qs'             # Search for package(s) in the local database
 441+# Additional pacman alias examples
 442+if [[ -x `which abs` ]]; then
 443+  alias pacupd='sudo pacman -Sy && sudo abs'     # Update and refresh the local package and ABS databases against repositories
 444+else
 445+  alias pacupd='sudo pacman -Sy'     # Update and refresh the local package and ABS databases against repositories
 446+fi
 447+alias pacinsd='sudo pacman -S --asdeps'        # Install given package(s) as dependencies of another package
 448+alias pacmir='sudo pacman -Syy'                # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
 449+
 450+# https://bbs.archlinux.org/viewtopic.php?id=93683
 451+paclist() {
 452+  sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}'
 453+}
 454+
 455+alias paclsorphans='sudo pacman -Qdt'
 456+alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
 457+
 458+pacdisowned() {
 459+  tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
 460+  db=$tmp/db
 461+  fs=$tmp/fs
 462+
 463+  mkdir "$tmp"
 464+  trap  'rm -rf "$tmp"' EXIT
 465+
 466+  pacman -Qlq | sort -u > "$db"
 467+
 468+  find /bin /etc /lib /sbin /usr \
 469+      ! -name lost+found \
 470+        \( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
 471+
 472+  comm -23 "$fs" "$db"
 473+}
 474diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
 475new file mode 100644
 476index 0000000000000000000000000000000000000000..da0a1276572dc655cc82eedc762e2996dac8b0b6
 477--- /dev/null
 478+++ b/plugins/autojump/autojump.plugin.zsh
 479@@ -0,0 +1,3 @@
 480+if [ -f `brew --prefix`/etc/autojump ]; then
 481+  . `brew --prefix`/etc/autojump
 482+fi
 483diff --git a/plugins/brew/_brew b/plugins/brew/_brew
 484index 4e590ac6302d0196a9b269798ea9f4ded913a05c..1dcf0a4bff26c50eec9a8023695cfe409db6053d 100644
 485--- a/plugins/brew/_brew
 486+++ b/plugins/brew/_brew
 487@@ -25,20 +25,27 @@ _1st_arguments=(
 488   'link:link a formula'
 489   'list:list files in a formula or not-installed formulae'
 490   'log:git commit log for a formula'
 491+  'missing:check all installed formuale for missing dependencies.'
 492   'outdated:list formulas for which a newer version is available'
 493   'prune:remove dead links'
 494   'remove:remove a formula'
 495   'search:search for a formula (/regex/ or string)'
 496+  'server:start a local web app that lets you browse formulae (requires Sinatra)'
 497   'unlink:unlink a formula'
 498   'update:freshen up links'
 499+  'upgrade:upgrade outdated formulae'
 500   'uses:show formulas which depend on a formula'
 501 )
 502 
 503 local expl
 504-local -a formula installed_formulae
 505+local -a formulae installed_formulae
 506 
 507 _arguments \
 508-  '(-v --verbose)'{-v,--verbose}'[verbose]' \
 509+  '(-v)-v[verbose]' \
 510+  '(--cellar)--cellar[brew cellar]' \
 511+  '(--config)--config[brew configuration]' \
 512+  '(--env)--env[brew environment]' \
 513+  '(--repository)--repository[brew repository]' \
 514   '(--version)--version[version information]' \
 515   '(--prefix)--prefix[where brew lives on this system]' \
 516   '(--cache)--cache[brew cache]' \
 517@@ -50,20 +57,24 @@ if (( CURRENT == 1 )); then
 518 fi
 519 
 520 case "$words[1]" in
 521-  list)
 522+  search|-S)
 523+    _arguments \
 524+      '(--macports)--macports[search the macports repository]' \
 525+      '(--fink)--fink[search the fink repository]' ;;
 526+  list|ls)
 527     _arguments \
 528       '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
 529+      '(--versions)--versions[list all installed versions of a formula]' \
 530       '1: :->forms' &&  return 0
 531 
 532       if [[ "$state" == forms ]]; then
 533         _brew_installed_formulae
 534-        _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae
 535+        _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
 536       fi ;;
 537-  install|home|log|info|uses|cat|deps)
 538+  install|home|homepage|log|info|abv|uses|cat|deps|edit|options)
 539     _brew_all_formulae
 540     _wanted formulae expl 'all formulae' compadd -a formulae ;;
 541-  remove|edit|xo)
 542+  remove|rm|uninstall|unlink|cleanup|link|ln)
 543     _brew_installed_formulae
 544     _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
 545 esac
 546-
 547diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh
 548index 353a18942ac594122f5bfc634fcef3f834d1c665..c2e95884e96fd6bb5faba415ebdbe6e9b11153f0 100644
 549--- a/plugins/brew/brew.plugin.zsh
 550+++ b/plugins/brew/brew.plugin.zsh
 551@@ -1,4 +1 @@
 552-# add brew completion function to path
 553-fpath=($ZSH/plugins/brew $fpath)
 554-autoload -U compinit
 555-compinit -i
 556+alias brews='brew list -1'
 557diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
 558index fb40e2cec10dc79da5875c660d18d70d4ee9ac10..f005700ff663c656a1c29cf167b5e1b759ab04e4 100644
 559--- a/plugins/bundler/bundler.plugin.zsh
 560+++ b/plugins/bundler/bundler.plugin.zsh
 561@@ -1,3 +1,37 @@
 562 alias be="bundle exec"
 563 alias bi="bundle install"
 564+alias bl="bundle list"
 565 alias bu="bundle update"
 566+alias bp="bundle package"
 567+
 568+# The following is based on https://github.com/gma/bundler-exec
 569+
 570+bundled_commands=(cap capify cucumber heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails)
 571+
 572+## Functions
 573+
 574+_bundler-installed() {
 575+  which bundle > /dev/null 2>&1
 576+}
 577+
 578+_within-bundled-project() {
 579+  local check_dir=$PWD
 580+  while [ "$(dirname $check_dir)" != "/" ]; do
 581+    [ -f "$check_dir/Gemfile" ] && return
 582+    check_dir="$(dirname $check_dir)"
 583+  done
 584+  false
 585+}
 586+
 587+_run-with-bundler() {
 588+  if _bundler-installed && _within-bundled-project; then
 589+    bundle exec $@
 590+  else
 591+    $@
 592+  fi
 593+}
 594+
 595+## Main program
 596+for cmd in $bundled_commands; do
 597+  alias $cmd="_run-with-bundler $cmd"
 598+done
 599diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/cake.plugin.zsh
 600new file mode 100644
 601index 0000000000000000000000000000000000000000..f968c71d582a35a9e175f0fc3a55d220f71d85fe
 602--- /dev/null
 603+++ b/plugins/cake/cake.plugin.zsh
 604@@ -0,0 +1,32 @@
 605+# Set this to 1 if you want to cache the tasks
 606+cache_task_list=1
 607+
 608+# Cache filename
 609+cache_file='.cake_task_cache'
 610+
 611+_cake_does_target_list_need_generating () {
 612+
 613+	if [ $cache_task_list -eq 0 ]; then
 614+		return 1;
 615+	fi
 616+
 617+	if [ ! -f $cache_file ]; then return 0;
 618+	else
 619+		accurate=$(stat -f%m $cache_file)
 620+		changed=$(stat -f%m Cakefile)
 621+		return $(expr $accurate '>=' $changed)
 622+	fi
 623+}
 624+
 625+_cake () {
 626+	if [ -f Cakefile ]; then
 627+		if _cake_does_target_list_need_generating; then
 628+			cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$' > $cache_file
 629+			compadd `cat $cache_file`
 630+		else
 631+			compadd `cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'`
 632+		fi
 633+	fi
 634+}
 635+
 636+compdef _cake cake
 637diff --git a/plugins/cap/cap.plugin.zsh b/plugins/cap/cap.plugin.zsh
 638index a0fa21d005e628888cf73c9f3e4abc56d1a090b1..8336182d5d8692f609b04d0c9c9c385fc6de5367 100644
 639--- a/plugins/cap/cap.plugin.zsh
 640+++ b/plugins/cap/cap.plugin.zsh
 641@@ -18,4 +18,4 @@ function _cap () {
 642   fi
 643 }
 644 
 645-compctl -K _cap cap
 646+compctl -K _cap cap
 647diff --git a/plugins/cloudapp/cloudapp.plugin.zsh b/plugins/cloudapp/cloudapp.plugin.zsh
 648new file mode 100644
 649index 0000000000000000000000000000000000000000..99252f690b13c0d247024187858c759898d9474f
 650--- /dev/null
 651+++ b/plugins/cloudapp/cloudapp.plugin.zsh
 652@@ -0,0 +1,2 @@
 653+#!/bin/zsh
 654+alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb
 655diff --git a/plugins/cloudapp/cloudapp.rb b/plugins/cloudapp/cloudapp.rb
 656new file mode 100755
 657index 0000000000000000000000000000000000000000..a11cfdb32be06a1fb1ea00933f306e2ff1e95715
 658--- /dev/null
 659+++ b/plugins/cloudapp/cloudapp.rb
 660@@ -0,0 +1,60 @@
 661+#!/usr/bin/env ruby
 662+#
 663+# cloudapp
 664+# Zach Holman / @holman
 665+#
 666+# Uploads a file from the command line to CloudApp, drops it into your 
 667+# clipboard (on a Mac, at least).
 668+#
 669+# Example:
 670+#
 671+#   cloudapp drunk-blake.png
 672+#
 673+# This requires Aaron Russell's cloudapp_api gem:
 674+#
 675+#   gem install cloudapp_api
 676+#
 677+# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of:
 678+#
 679+#   email
 680+#   password
 681+
 682+require 'rubygems'
 683+begin
 684+  require 'cloudapp_api'
 685+rescue LoadError
 686+  puts "You need to install cloudapp_api: gem install cloudapp_api"
 687+  exit!(1)
 688+end
 689+
 690+config_file = "#{ENV['HOME']}/.cloudapp"
 691+unless File.exist?(config_file)
 692+  puts "You need to type your email and password (one per line) into "+
 693+       "`~/.cloudapp`"
 694+  exit!(1)
 695+end
 696+
 697+email,password = File.read(config_file).split("\n")
 698+
 699+class HTTParty::Response
 700+  # Apparently HTTPOK.ok? IS NOT OKAY WTFFFFFFFFFFUUUUUUUUUUUUUU
 701+  # LETS MONKEY PATCH IT I FEEL OKAY ABOUT IT
 702+  def ok? ; true end
 703+end
 704+
 705+if ARGV[0].nil?
 706+   puts "You need to specify a file to upload."
 707+   exit!(1)
 708+end
 709+
 710+CloudApp.authenticate(email,password)
 711+url = CloudApp::Item.create(:upload, {:file => ARGV[0]}).url
 712+
 713+# Say it for good measure.
 714+puts "Uploaded to #{url}."
 715+
 716+# Get the embed link.
 717+url = "#{url}/#{ARGV[0].split('/').last}"
 718+
 719+# Copy it to your (Mac's) clipboard.
 720+`echo '#{url}' | tr -d "\n" | pbcopy`
 721diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/compleat.plugin.zsh
 722new file mode 100644
 723index 0000000000000000000000000000000000000000..38f1b396aabf16926d6f0aff06e6f20b2840ab40
 724--- /dev/null
 725+++ b/plugins/compleat/compleat.plugin.zsh
 726@@ -0,0 +1,20 @@
 727+# ------------------------------------------------------------------------------
 728+#          FILE:  compleat.plugin.zsh
 729+#   DESCRIPTION:  oh-my-zsh plugin file.
 730+#        AUTHOR:  Sorin Ionescu (sorin.ionescu@gmail.com)
 731+#       VERSION:  1.0.0
 732+# ------------------------------------------------------------------------------
 733+
 734+if (( ${+commands[compleat]} )); then
 735+  local prefix="${commands[compleat]:h:h}"
 736+  local setup="${prefix}/share/compleat-1.0/compleat_setup" 
 737+
 738+  if [[ -f "$setup" ]]; then
 739+    if ! bashcompinit >/dev/null 2>&1; then
 740+      autoload -U bashcompinit
 741+      bashcompinit -i
 742+    fi
 743+
 744+    source "$setup" 
 745+  fi
 746+fi
 747diff --git a/plugins/cpanm/cpanm.plugin.zsh b/plugins/cpanm/cpanm.plugin.zsh
 748deleted file mode 100644
 749index af52d3e8b2567a2a61f9f41cae8f3b15e0d4b933..0000000000000000000000000000000000000000
 750--- a/plugins/cpanm/cpanm.plugin.zsh
 751+++ /dev/null
 752@@ -1,4 +0,0 @@
 753-# add cpanm completion function to path
 754-fpath=($ZSH/plugins/cpanm $fpath)
 755-autoload -U compinit
 756-compinit -i
 757diff --git a/plugins/deb/deb.plugin.zsh b/plugins/deb/deb.plugin.zsh
 758index 732294a87d08858a8abb05248d19a27256680eca..1b35a064628625497cd67c2163c00d02a4c35cff 100644
 759--- a/plugins/deb/deb.plugin.zsh
 760+++ b/plugins/deb/deb.plugin.zsh
 761@@ -9,4 +9,5 @@ alias ar="sudo apt-get remove --purge && \
 762 		sudo apt-get autoremove --purge"	# remove package
 763 alias ap="apt-cache policy"				# apt policy
 764 alias av="apt-cache show"				# show package info
 765+alias acs="apt-cache search"                            # search package
 766 alias ac="sudo apt-get clean && sudo apt-get autoclean" # clean apt cache
 767diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh
 768new file mode 100644
 769index 0000000000000000000000000000000000000000..1d72a2f2c13f20d33ee63f5ec9918621bdb6827a
 770--- /dev/null
 771+++ b/plugins/django/django.plugin.zsh
 772@@ -0,0 +1,222 @@
 773+#compdef manage.py
 774+
 775+typeset -ga nul_args
 776+nul_args=(
 777+  '--settings=-[the Python path to a settings module.]:file:_files'
 778+  '--pythonpath=-[a directory to add to the Python path.]::directory:_directories'
 779+  '--traceback[print traceback on exception.]'
 780+  "--version[show program's version number and exit.]"
 781+  {-h,--help}'[show this help message and exit.]'
 782+)
 783+
 784+_managepy-adminindex(){
 785+  _arguments -s : \
 786+    $nul_args \
 787+    '*::directory:_directories' && ret=0
 788+}
 789+
 790+_managepy-createcachetable(){
 791+  _arguments -s : \
 792+    $nul_args && ret=0
 793+}
 794+
 795+_managepy-dbshell(){
 796+  _arguments -s : \
 797+    $nul_args && ret=0
 798+}
 799+
 800+_managepy-diffsettings(){
 801+  _arguments -s : \
 802+    $nul_args && ret=0
 803+}
 804+
 805+_managepy-dumpdata(){
 806+  _arguments -s : \
 807+    '--format=-[specifies the output serialization format for fixtures.]:format:(json yaml xml)' \
 808+    '--indent=-[specifies the indent level to use when pretty-printing output.]:' \
 809+    $nul_args \
 810+    '*::appname:_applist' && ret=0
 811+}
 812+
 813+_managepy-flush(){
 814+  _arguments -s : \
 815+    '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
 816+    '--noinput[tells Django to NOT prompt the user for input of any kind.]' \
 817+    $nul_args && ret=0
 818+}
 819+
 820+_managepy-help(){
 821+  _arguments -s : \
 822+    '*:command:_managepy_cmds' \
 823+    $nul_args && ret=0
 824+}
 825+
 826+_managepy_cmds(){
 827+    local line
 828+    local -a cmd
 829+    _call_program help-command ./manage.py help \
 830+      |& sed -n '/^ /s/[(), ]/ /gp' \
 831+      | while read -A line; do cmd=($line $cmd) done
 832+    _describe -t managepy-command 'manage.py command' cmd
 833+}
 834+
 835+_managepy-inspectdb(){
 836+  _arguments -s : \
 837+    $nul_args && ret=0
 838+}
 839+
 840+_managepy-loaddata(){
 841+  _arguments -s : \
 842+    '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
 843+    '*::file:_files' \
 844+    $nul_args && ret=0
 845+}
 846+
 847+_managepy-reset(){
 848+  _arguments -s : \
 849+    '--noinput[tells Django to NOT prompt the user for input of any kind.]' \
 850+    '*::appname:_applist' \
 851+    $nul_args && ret=0
 852+}
 853+
 854+_managepy-runfcgi(){
 855+  local state
 856+  
 857+  local fcgi_opts
 858+  fcgi_opts=(
 859+    'protocol[fcgi, scgi, ajp, ... (default fcgi)]:protocol:(fcgi scgi ajp)'
 860+    'host[hostname to listen on..]:'
 861+    'port[port to listen on.]:'
 862+    'socket[UNIX socket to listen on.]::file:_files'
 863+    'method[prefork or threaded (default prefork)]:method:(prefork threaded)'
 864+    'maxrequests[number of requests a child handles before it is killed and a new child is forked (0 = no limit).]:'
 865+    'maxspare[max number of spare processes / threads.]:'
 866+    'minspare[min number of spare processes / threads.]:'
 867+    'maxchildren[hard limit number of processes / threads.]:'
 868+    'daemonize[whether to detach from terminal.]:boolean:(False True)'
 869+    'pidfile[write the spawned process-id to this file.]:file:_files'
 870+    'workdir[change to this directory when daemonizing.]:directory:_files'
 871+    'outlog[write stdout to this file.]:file:_files'
 872diff --git a/plugins/extract/_extract b/plugins/extract/_extract
 873new file mode 100644
 874index 0000000000000000000000000000000000000000..dca890954aaad3e36543d18b6fc8b04c090cfc7d
 875--- /dev/null
 876+++ b/plugins/extract/_extract
 877@@ -0,0 +1,8 @@
 878+#compdef extract
 879+#autoload
 880+
 881+_arguments \
 882+  '(-r --remove)'{-r,--remove}'[Remove archive.]' \
 883+  "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0
 884+
 885+
 886diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
 887new file mode 100644
 888index 0000000000000000000000000000000000000000..8cc17f7d4be725da84afaf018cb8343e3048ad5d
 889--- /dev/null
 890+++ b/plugins/extract/extract.plugin.zsh
 891@@ -0,0 +1,85 @@
 892+# ------------------------------------------------------------------------------
 893+#          FILE:  extract.plugin.zsh
 894+#   DESCRIPTION:  oh-my-zsh plugin file.
 895+#        AUTHOR:  Sorin Ionescu (sorin.ionescu@gmail.com)
 896+#       VERSION:  1.0.1
 897+# ------------------------------------------------------------------------------
 898+
 899+
 900+function extract() {
 901+  local remove_archive
 902+  local success
 903+  local file_name
 904+  local extract_dir
 905+
 906+  if (( $# == 0 )); then
 907+    echo "Usage: extract [-option] [file ...]"
 908+    echo
 909+    echo Options:
 910+    echo "    -r, --remove    Remove archive."
 911+    echo
 912+    echo "Report bugs to <sorin.ionescu@gmail.com>."
 913+  fi
 914+
 915+  remove_archive=1
 916+  if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then
 917+    remove_archive=0 
 918+    shift
 919+  fi
 920+
 921+  while (( $# > 0 )); do
 922+    if [[ ! -f "$1" ]]; then
 923+      echo "extract: '$1' is not a valid file" 1>&2
 924+      shift
 925+      continue
 926+    fi
 927+
 928+    success=0
 929+    file_name="$( basename "$1" )"
 930+    extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )"
 931+    case "$1" in
 932+      (*.tar.gz|*.tgz) tar xvzf "$1" ;;
 933+      (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
 934+      (*.tar.xz|*.txz) tar --xz --help &> /dev/null \
 935+        && tar --xz -xvf "$1" \
 936+        || xzcat "$1" | tar xvf - ;;
 937+      (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
 938+        && tar --lzma -xvf "$1" \
 939+        || lzcat "$1" | tar xvf - ;;
 940+      (*.tar) tar xvf "$1" ;;
 941+      (*.gz) gunzip "$1" ;;
 942+      (*.bz2) bunzip2 "$1" ;;
 943+      (*.xz) unxz "$1" ;;
 944+      (*.lzma) unlzma "$1" ;;
 945+      (*.Z) uncompress "$1" ;;
 946+      (*.zip) unzip "$1" -d $extract_dir ;;
 947+      (*.rar) unrar e -ad "$1" ;;
 948+      (*.7z) 7za x "$1" ;;
 949+      (*.deb)
 950+        mkdir -p "$extract_dir/control"
 951+        mkdir -p "$extract_dir/data"
 952+        cd "$extract_dir"; ar vx "../${1}" > /dev/null
 953+        cd control; tar xzvf ../control.tar.gz
 954+        cd ../data; tar xzvf ../data.tar.gz
 955+        cd ..; rm *.tar.gz debian-binary
 956+        cd ..
 957+      ;;
 958+      (*) 
 959+        echo "extract: '$1' cannot be extracted" 1>&2
 960+        success=1 
 961+      ;; 
 962+    esac
 963+
 964+    (( success = $success > 0 ? $success : $? ))
 965+    (( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
 966+    shift
 967+  done
 968+}
 969+
 970+alias x=extract
 971+
 972+# add extract completion function to path
 973+fpath=($ZSH/plugins/extract $fpath)
 974+autoload -U compinit
 975+compinit -i
 976+
 977diff --git a/plugins/gas/_gas b/plugins/gas/_gas
 978new file mode 100644
 979index 0000000000000000000000000000000000000000..befdc94598df69bba47201e6933829b4fb39fbce
 980--- /dev/null
 981+++ b/plugins/gas/_gas
 982@@ -0,0 +1,34 @@
 983+#compdef gas
 984+
 985+local curcontext="$curcontext" state line cmds ret=1
 986+
 987+_arguments -C \
 988+	'(- 1 *)'{-v,--version}'[display version information]' \
 989+	'(-h|--help)'{-h,--help}'[show help information]' \
 990+	'1: :->cmds' \
 991+	'*: :->args' && ret=0
 992+
 993+case $state in
 994+	cmds)
 995+		cmds=(
 996+            "version:Prints Gas's version"
 997+            "use:Uses author"
 998+            "show:Shows your current user"
 999+            "list:Lists your authors"
1000+            "import:Imports current user to gasconfig"
1001+            "help:Describe available tasks or one specific task"
1002+            "delete:Deletes author"
1003+            "add:Adds author to gasconfig"
1004+        )
1005+		_describe -t commands 'gas command' cmds && ret=0
1006+		;;
1007+	args)
1008+		case $line[1] in
1009+			(use|delete)
1010+				_values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
1011+				;;
1012+		esac
1013+		;;
1014+esac
1015+
1016+return ret
1017diff --git a/plugins/gem/gem.plugin.zsh b/plugins/gem/gem.plugin.zsh
1018deleted file mode 100644
1019index d4e5c6584a8289c6d4097cd2090fb71a48ef69c6..0000000000000000000000000000000000000000
1020--- a/plugins/gem/gem.plugin.zsh
1021+++ /dev/null
1022@@ -1,4 +0,0 @@
1023-# add gem completion function to path
1024-fpath=($ZSH/plugins/gem $fpath)
1025-autoload -U compinit
1026-compinit -i
1027diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh
1028new file mode 100644
1029index 0000000000000000000000000000000000000000..270bcbe389b79224d4725e45be39abb4c3823829
1030--- /dev/null
1031+++ b/plugins/git-flow/git-flow.plugin.zsh
1032@@ -0,0 +1,332 @@
1033+#!zsh
1034+#
1035+# Installation
1036+# ------------
1037+#
1038+# To achieve git-flow completion nirvana:
1039+#
1040+#  0. Update your zsh's git-completion module to the newest verion.
1041+#     From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
1042+#
1043+#  1. Install this file. Either:
1044+#
1045+#     a. Place it in your .zshrc:
1046+#
1047+#     b. Or, copy it somewhere (e.g. ~/.git-flow-completion.zsh) and put the following line in
1048+#        your .zshrc:
1049+#
1050+#            source ~/.git-flow-completion.zsh
1051+#
1052+#     c. Or, use this file as a oh-my-zsh plugin.
1053+#
1054+
1055+_git-flow ()
1056+{
1057+	local curcontext="$curcontext" state line
1058+	typeset -A opt_args
1059+
1060+	_arguments -C \
1061+		':command:->command' \
1062+		'*::options:->options'
1063+
1064+	case $state in
1065+		(command)
1066+
1067+			local -a subcommands
1068+			subcommands=(
1069+				'init:Initialize a new git repo with support for the branching model.'
1070+				'feature:Manage your feature branches.'
1071+				'release:Manage your release branches.'
1072+				'hotfix:Manage your hotfix branches.'
1073+				'support:Manage your support branches.'
1074+				'version:Shows version information.'
1075+			)
1076+			_describe -t commands 'git flow' subcommands
1077+		;;
1078+
1079+		(options)
1080+			case $line[1] in
1081+
1082+				(init)
1083+					_arguments \
1084+						-f'[Force setting of gitflow branches, even if already configured]'
1085+					;;
1086+
1087+					(version)
1088+					;;
1089+
1090+					(hotfix)
1091+						__git-flow-hotfix
1092+					;;
1093+
1094+					(release)
1095+						__git-flow-release
1096+					;;
1097+
1098+					(feature)
1099+						__git-flow-feature
1100+					;;
1101+			esac
1102+		;;
1103+	esac
1104+}
1105+
1106+__git-flow-release ()
1107+{
1108+	local curcontext="$curcontext" state line
1109+	typeset -A opt_args
1110+
1111+	_arguments -C \
1112+		':command:->command' \
1113+		'*::options:->options'
1114+
1115+	case $state in
1116+		(command)
1117+
1118+			local -a subcommands
1119+			subcommands=(
1120+				'start:Start a new release branch.'
1121+				'finish:Finish a release branch.'
1122+				'list:List all your release branches. (Alias to `git flow release`)'
1123+			)
1124+			_describe -t commands 'git flow release' subcommands
1125+			_arguments \
1126+				-v'[Verbose (more) output]'
1127+		;;
1128+
1129+		(options)
1130+			case $line[1] in
1131+
1132diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
1133index 71a62819bbd5decbd8de84a83f14ee98fbc56925..5132b639afebcf2c722f1a4b6d31a43dd517774e 100644
1134--- a/plugins/git/git.plugin.zsh
1135+++ b/plugins/git/git.plugin.zsh
1136@@ -1,23 +1,41 @@
1137 # Aliases
1138 alias g='git'
1139+compdef g=git
1140 alias gst='git status'
1141+compdef _git gst=git-status
1142 alias gl='git pull'
1143+compdef _git gl=git-pull
1144 alias gup='git fetch && git rebase'
1145+compdef _git gup=git-fetch
1146 alias gp='git push'
1147-alias gd='git diff | mate'
1148-alias gdv='git diff -w "$@" | vim -R -'
1149+compdef _git gp=git-push
1150+gdv() { git-diff -w "$@" | view - }
1151+compdef _git gdv=git-diff
1152 alias gc='git commit -v'
1153+compdef _git gc=git-commit
1154 alias gca='git commit -v -a'
1155+compdef _git gca=git-commit
1156 alias gco='git checkout'
1157+compdef _git gco=git-checkout
1158 alias gb='git branch'
1159+compdef _git gb=git-branch
1160 alias gba='git branch -a'
1161+compdef _git gba=git-branch
1162 alias gcount='git shortlog -sn'
1163+compdef gcount=git
1164 alias gcp='git cherry-pick'
1165+compdef _git gcp=git-cherry-pick
1166 alias glg='git log --stat --max-count=5'
1167+compdef _git glg=git-log
1168+alias glgg='git log --graph --max-count=5'
1169+compdef _git glgg=git-log
1170 
1171 # Git and svn mix
1172 alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
1173+compdef git-svn-dcommit-push=git
1174 
1175+alias gsr='git svn rebase'
1176+alias gsd='git svn dcommit'
1177 #
1178 # Will return the current branch name
1179 # Usage example: git pull origin $(current_branch)
1180@@ -29,5 +47,8 @@ function current_branch() {
1181 
1182 # these aliases take advantage of the previous function
1183 alias ggpull='git pull origin $(current_branch)'
1184+compdef ggpull=git
1185 alias ggpush='git push origin $(current_branch)'
1186+compdef ggpush=git
1187 alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
1188+compdef ggpnp=git
1189diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh
1190index c23504b85b464b411c14abcbe9301e9348ebf5f6..1eb3381136818b82b1915cb5113d1877fc0907a5 100644
1191--- a/plugins/github/github.plugin.zsh
1192+++ b/plugins/github/github.plugin.zsh
1193@@ -1,4 +1,6 @@
1194-# add github completion function to path
1195-fpath=($ZSH/plugins/github $fpath)
1196-autoload -U compinit
1197-compinit -i
1198+# hub alias from defunkt
1199+# https://github.com/defunkt/hub
1200+if [ "$commands[(I)hub]" ]; then
1201+    # eval `hub alias -s zsh`
1202+    function git(){hub "$@"}
1203+fi
1204diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh
1205new file mode 100644
1206index 0000000000000000000000000000000000000000..8cc71fd57692de243e8a497786d1e1f8eb0b2bba
1207--- /dev/null
1208+++ b/plugins/gpg-agent/gpg-agent.plugin.zsh
1209@@ -0,0 +1,26 @@
1210+# Based on ssh-agent code
1211+
1212+local GPG_ENV=$HOME/.gnupg/gpg-agent.env
1213+
1214+function start_agent {
1215+  /usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV} > /dev/null
1216+  chmod 600 ${GPG_ENV}
1217+  . ${GPG_ENV} > /dev/null
1218+}
1219+
1220+# Source GPG agent settings, if applicable
1221+if [ -f "${GPG_ENV}" ]; then
1222+  . ${GPG_ENV} > /dev/null
1223+  ps -ef | grep ${SSH_AGENT_PID} | grep gpg-agent > /dev/null || {
1224+    start_agent;
1225+  }
1226+else
1227+  start_agent;
1228+fi
1229+
1230+export GPG_AGENT_INFO
1231+export SSH_AUTH_SOCK
1232+export SSH_AGENT_PID
1233+
1234+GPG_TTY=$(tty)
1235+export GPG_TTY
1236diff --git a/plugins/history-substring-search/README b/plugins/history-substring-search/README
1237new file mode 100644
1238index 0000000000000000000000000000000000000000..be11adf76b54ce2e7f8dc4ad14c61c1c3a62ad28
1239--- /dev/null
1240+++ b/plugins/history-substring-search/README
1241@@ -0,0 +1,7 @@
1242+To activate this script, load it into an interactive ZSH session:
1243+
1244+  % source history-substring-search.zsh
1245+
1246+See the "history-substring-search.zsh" file for more information:
1247+
1248+  % sed -n '2,/^$/s/^#//p' history-substring-search.zsh | more
1249diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh
1250new file mode 100644
1251index 0000000000000000000000000000000000000000..99a5922c5faa3d3130578e119e18a4d7ad6eac55
1252--- /dev/null
1253+++ b/plugins/history-substring-search/history-substring-search.plugin.zsh
1254@@ -0,0 +1,12 @@
1255+# This file integrates the history-substring-search script into oh-my-zsh.
1256+
1257+source "$ZSH/plugins/history-substring-search/history-substring-search.zsh"
1258+
1259+if test "$CASE_SENSITIVE" = true; then
1260+  unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS
1261+fi
1262+
1263+if test "$DISABLE_COLOR" = true; then
1264+  unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
1265+  unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
1266+fi
1267diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh
1268new file mode 100644
1269index 0000000000000000000000000000000000000000..53f707c79c11c72931fcae67eeb6931b29cbade0
1270--- /dev/null
1271+++ b/plugins/history-substring-search/history-substring-search.zsh
1272@@ -0,0 +1,642 @@
1273+#!/usr/bin/env zsh
1274+#
1275+# This is a clean-room implementation of the Fish[1] shell's history search
1276+# feature, where you can type in any part of any previously entered command
1277+# and press the UP and DOWN arrow keys to cycle through the matching commands.
1278+#
1279+#-----------------------------------------------------------------------------
1280+# Usage
1281+#-----------------------------------------------------------------------------
1282+#
1283+# 1. Load this script into your interactive ZSH session:
1284+#
1285+#       % source history-substring-search.zsh
1286+#
1287+#    If you want to use the zsh-syntax-highlighting[6] script along with this
1288+#    script, then make sure that you load it *before* you load this script:
1289+#
1290+#       % source zsh-syntax-highlighting.zsh
1291+#       % source history-substring-search.zsh
1292+#
1293+# 2. Type any part of any previous command and then:
1294+#
1295+#     * Press the UP arrow key to select the nearest command that (1) contains
1296+#       your query and (2) is older than the current command in the command
1297+#       history.
1298+#
1299+#     * Press the DOWN arrow key to select the nearest command that (1)
1300+#       contains your query and (2) is newer than the current command in the
1301+#       command history.
1302+#
1303+#     * Press ^U (the Control and U keys simultaneously) to abort the search.
1304+#
1305+# 3. If a matching command spans more than one line of text, press the LEFT
1306+#    arrow key to move the cursor away from the end of the command, and then:
1307+#
1308+#     * Press the UP arrow key to move the cursor to the line above.  When the
1309+#       cursor reaches the first line of the command, pressing the UP arrow
1310+#       key again will cause this script to perform another search.
1311+#
1312+#     * Press the DOWN arrow key to move the cursor to the line below.  When
1313+#       the cursor reaches the last line of the command, pressing the DOWN
1314+#       arrow key again will cause this script to perform another search.
1315+#
1316+#-----------------------------------------------------------------------------
1317+# Configuration
1318+#-----------------------------------------------------------------------------
1319+#
1320+# This script defines the following global variables. You may override their
1321+# default values only after having loaded this script into your ZSH session.
1322+#
1323+# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND is a global variable that defines
1324+#   how the query should be highlighted inside a matching command. Its default
1325+#   value causes this script to highlight using bold, white text on a magenta
1326+#   background. See the "Character Highlighting" section in the zshzle(1) man
1327+#   page to learn about the kinds of values you may assign to this variable.
1328+#
1329+# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND is a global variable that
1330+#   defines how the query should be highlighted when no commands in the
1331+#   history match it. Its default value causes this script to highlight using
1332+#   bold, white text on a red background. See the "Character Highlighting"
1333+#   section in the zshzle(1) man page to learn about the kinds of values you
1334+#   may assign to this variable.
1335+#
1336+# * HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS is a global variable that defines
1337+#   how the command history will be searched for your query. Its default value
1338+#   causes this script to perform a case-insensitive search. See the "Globbing
1339+#   Flags" section in the zshexpn(1) man page to learn about the kinds of
1340+#   values you may assign to this variable.
1341+#
1342+#-----------------------------------------------------------------------------
1343+# History
1344+#-----------------------------------------------------------------------------
1345+#
1346+# This script was originally written by Peter Stephenson[2], who published it
1347+# to the ZSH users mailing list (thereby making it public domain) in September
1348+# 2009. It was later revised by Guido van Steen and released under the BSD
1349+# license (see below) as part of the fizsh[3] project in January 2011.
1350+#
1351+# It was later extracted from fizsh[3] release 1.0.1, refactored heavily, and
1352+# repackaged as both an oh-my-zsh plugin[4] and as an independently loadable
1353+# ZSH script[5] by Suraj N. Kurapati in 2011.
1354+#
1355+# It was further developed[4] by Guido van Steen, Suraj N. Kurapati, Sorin
1356+# Ionescu, and Vincent Guerci in 2011.
1357+#
1358+# [1]: http://fishshell.com
1359+# [2]: http://www.zsh.org/mla/users/2009/msg00818.html
1360+# [3]: http://sourceforge.net/projects/fizsh/
1361+# [4]: https://github.com/robbyrussell/oh-my-zsh/pull/215
1362+# [5]: https://github.com/sunaku/zsh-history-substring-search
1363+# [6]: https://github.com/nicoulaj/zsh-syntax-highlighting
1364+#
1365+##############################################################################
1366+#
1367+# Copyright (c) 2009 Peter Stephenson
1368+# Copyright (c) 2011 Guido van Steen
1369+# Copyright (c) 2011 Suraj N. Kurapati
1370+# Copyright (c) 2011 Sorin Ionescu
1371+# Copyright (c) 2011 Vincent Guerci
1372diff --git a/plugins/kate/kate.plugin.zsh b/plugins/kate/kate.plugin.zsh
1373new file mode 100644
1374index 0000000000000000000000000000000000000000..eb16522acafa12576aa2bcddac5d7b6b5448443c
1375--- /dev/null
1376+++ b/plugins/kate/kate.plugin.zsh
1377@@ -0,0 +1,9 @@
1378+
1379+# Kate
1380+# Start kate always silent
1381+alias kate='kate >/dev/null 2>&1'
1382+
1383+function kt () {
1384+  cd $1
1385+  kate $1
1386+}
1387diff --git a/plugins/knife/_knife b/plugins/knife/_knife
1388new file mode 100644
1389index 0000000000000000000000000000000000000000..7f8c95ee5a470810785cb719828371a5e7463e6c
1390--- /dev/null
1391+++ b/plugins/knife/_knife
1392@@ -0,0 +1,174 @@
1393+#compdef knife
1394+
1395+# These flags should be available everywhere according to man knife
1396+knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
1397+
1398+# knife has a very special syntax, some example calls are:
1399+# knife status
1400+# knife cookbook list
1401+# knife role show ROLENAME
1402+# knife data bag show DATABAGNAME
1403+# knife role show ROLENAME --attribute ATTRIBUTENAME
1404+# knife cookbook show COOKBOOKNAME COOKBOOKVERSION recipes
1405+
1406+# The -Q switch in compadd allow for completions of things like "data bag" without having to go through two rounds of completion and avoids zsh inserting a \ for escaping spaces
1407+_knife() {
1408+  local curcontext="$curcontext" state line
1409+  typeset -A opt_args
1410+  cloudproviders=(bluebox ec2 rackspace slicehost terremark)
1411+  _arguments \
1412+    '1: :->knifecmd'\
1413+    '2: :->knifesubcmd'\
1414+    '3: :->knifesubcmd2' \
1415+    '4: :->knifesubcmd3' \
1416+    '5: :->knifesubcmd4' \
1417+    '6: :->knifesubcmd5'
1418+  
1419+  case $state in
1420+  knifecmd)
1421+    compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders
1422+  ;;
1423+  knifesubcmd)
1424+    case $words[2] in
1425+    (bluebox|ec2|rackspace|slicehost|terremark)
1426+      compadd "$@" server images
1427+    ;;
1428+    client)
1429+      compadd -Q "$@" "bulk delete" list create show delete edit reregister
1430+    ;;
1431+    configure)
1432+      compadd "$@" client
1433+    ;;
1434+    cookbook)
1435+      compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
1436+    ;;
1437+    node)
1438+     compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
1439+    ;;
1440+    recipe)
1441+     compadd "$@" list
1442+    ;;
1443+    role)
1444+      compadd -Q "$@" "bulk delete" create delete edit "from file" list show
1445+    ;; 
1446+    windows)
1447+      compadd "$@" bootstrap
1448+    ;;
1449+    *)
1450+    _arguments '2:Subsubcommands:($(_knife_options1))'
1451+    esac
1452+   ;;
1453+   knifesubcmd2)
1454+    case $words[3] in
1455+     server)
1456+      compadd "$@" list create delete
1457+    ;;
1458+     images)
1459+      compadd "$@" list
1460+    ;;
1461+     site)
1462+      compadd "$@" vendor show share search download list unshare
1463+    ;;
1464+     (show|delete|edit)
1465+     _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))'
1466+    ;;
1467+    (upload|test)
1468+     _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)'
1469+    ;;
1470+    list)
1471+     compadd -a "$@" knife_general_flags
1472+    ;;
1473+    bag)
1474+      compadd -Q "$@" show edit list "from file" create delete
1475+    ;;
1476+    *)
1477+      _arguments '3:Subsubcommands:($(_knife_options2))'
1478+    esac
1479+   ;;
1480+   knifesubcmd3)
1481+     case $words[3] in
1482+      show)
1483+       case $words[2] in
1484+       cookbook)
1485+          versioncomp=1
1486+          _arguments '4:Cookbookversions:($(_cookbook_versions) latest)'
1487+       ;;
1488+       (node|client|role)
1489+         compadd "$@" --attribute
1490+       esac
1491+     esac
1492diff --git a/plugins/lein/lein.plugin.zsh b/plugins/lein/lein.plugin.zsh
1493new file mode 100644
1494index 0000000000000000000000000000000000000000..19af3556a662b89a55a6b00e022a8018953cddd3
1495--- /dev/null
1496+++ b/plugins/lein/lein.plugin.zsh
1497@@ -0,0 +1,27 @@
1498+function _lein_commands() {
1499+    local ret=1 state
1500+    _arguments ':subcommand:->subcommand' && ret=0
1501+
1502+    case $state in
1503+      subcommand)
1504+        subcommands=(
1505+          "clean:remove compiled files and dependencies from project"
1506+          "compile:ahead-of-time compile the project"
1507+          "deps:download and install all dependencies"
1508+          "help:display a list of tasks or help for a given task"
1509+          "install:install the project and its dependencies in your local repository"
1510+          "jar:create a jar file containing the compiled .class files"
1511+          "new:create a new project skeleton"
1512+          "pom:write a pom.xml file to disk for maven interop"
1513+          "test:run the project's tests"
1514+          "uberjar:Create a jar including the contents of each of deps"
1515+          "upgrade:upgrade leiningen to the latest stable release"
1516+          "version:print leiningen's version"
1517+        )
1518+        _describe -t subcommands 'leiningen subcommands' subcommands && ret=0
1519+    esac
1520+
1521+    return ret
1522+}
1523+
1524+compdef _lein_commands lein
1525diff --git a/plugins/macports/macports.plugin.zsh b/plugins/macports/macports.plugin.zsh
1526index cbbc4926596480a1567ae5b36e812412c3c901d3..277352e321afd49b954cb91223cf59f9eaf399a3 100644
1527--- a/plugins/macports/macports.plugin.zsh
1528+++ b/plugins/macports/macports.plugin.zsh
1529@@ -6,7 +6,3 @@ alias puni="sudo port uninstall inactive"
1530 alias puo="sudo port upgrade outdated"
1531 alias pup="psu && puo"
1532 
1533-# add macports completion function to path
1534-fpath=($ZSH/plugins/macports $fpath)
1535-autoload -U compinit
1536-compinit -i
1537diff --git a/plugins/mysql-macports/mysql-macports.plugin.zsh b/plugins/mysql-macports/mysql-macports.plugin.zsh
1538new file mode 100644
1539index 0000000000000000000000000000000000000000..c39563fe49c0cbc81dd7eb9ca8feeb5bc54a3da0
1540--- /dev/null
1541+++ b/plugins/mysql-macports/mysql-macports.plugin.zsh
1542@@ -0,0 +1,8 @@
1543+# commands to control local mysql-server installation
1544+# paths are for osx installation via macports
1545+
1546+alias mysqlstart='sudo /opt/local/share/mysql5/mysql/mysql.server start'
1547+alias mysqlstop='sudo /opt/local/share/mysql5/mysql/mysql.server stop'
1548+alias mysqlrestart='sudo /opt/local/share/mysql5/mysql/mysql.server restart'
1549+
1550+alias mysqlstatus='mysqladmin5 -u root -p ping'
1551diff --git a/plugins/mysql/mysql-macports.plugin.zsh b/plugins/mysql/mysql-macports.plugin.zsh
1552deleted file mode 100644
1553index 63b881c9f5b74f8f11770b20fe40749add1f23ae..0000000000000000000000000000000000000000
1554--- a/plugins/mysql/mysql-macports.plugin.zsh
1555+++ /dev/null
1556@@ -1,6 +0,0 @@
1557-# commands to control local mysql-server installation
1558-# paths are for osx installtion via macports
1559-
1560-alias mysqlstart='sudo /opt/local/bin/mysqld_safe5'
1561-alias mysqlstop='/opt/local/bin/mysqladmin5 -u root -p shutdown'
1562-alias mysqlstatus='mysqladmin5 -u root -p ping'
1563diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh
1564new file mode 100644
1565index 0000000000000000000000000000000000000000..519bc18da425f86f2a5fd433cad5075d79a1075a
1566--- /dev/null
1567+++ b/plugins/node/node.plugin.zsh
1568@@ -0,0 +1,5 @@
1569+# Open the node api for your current version to the optional section.
1570+# TODO: Make the section part easier to use.
1571+function node-docs {
1572+	open "http://nodejs.org/docs/$(node --version)/api/all.html#$1"
1573+}
1574diff --git a/plugins/npm/_npm b/plugins/npm/_npm
1575new file mode 100644
1576index 0000000000000000000000000000000000000000..24b536188e08a12e9422fef49c16409b478d329c
1577--- /dev/null
1578+++ b/plugins/npm/_npm
1579@@ -0,0 +1,19 @@
1580+#compdef npm
1581+
1582+# Node Package Manager 0.3.15 completion, letting npm do all the completion work
1583+
1584+_npm() {
1585+  compadd -- $(_npm_complete $words)
1586+}
1587+
1588+# We want to show all errors of any substance, but never the "npm (not )ok" one.
1589+# (Also doesn't consider "ERR! no match found" worth breaking the terminal for.)
1590+_npm_complete() {
1591+  local ask_npm
1592+  ask_npm=(npm completion --color false --loglevel error -- $@)
1593+  { _call_program npm $ask_npm 2>&1 >&3 \
1594+  | egrep -v '^(npm (not |)ok|ERR! no match found)$' >&2; \
1595+  } 3>&1
1596+}
1597+
1598+_npm "$@"
1599diff --git a/plugins/osx/_man-preview b/plugins/osx/_man-preview
1600new file mode 100644
1601index 0000000000000000000000000000000000000000..6cc344ad4609fe125fd510a60219c7ed82b10faa
1602--- /dev/null
1603+++ b/plugins/osx/_man-preview
1604@@ -0,0 +1,5 @@
1605+#compdef man-preview
1606+#autoload
1607+
1608+_man
1609+
1610diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
1611index 81eed5e92af372466fc02bb682a9d5a8b26091e8..682bb2667bc2cec79c6edd5870d4d42c871844f2 100644
1612--- a/plugins/osx/osx.plugin.zsh
1613+++ b/plugins/osx/osx.plugin.zsh
1614@@ -1,57 +1,99 @@
1615-function savepath() {
1616-  pwd > ~/.current_path~
1617-}
1618+# ------------------------------------------------------------------------------
1619+#          FILE:  osx.plugin.zsh
1620+#   DESCRIPTION:  oh-my-zsh plugin file.
1621+#        AUTHOR:  Sorin Ionescu (sorin.ionescu@gmail.com)
1622+#       VERSION:  1.0.1
1623+# ------------------------------------------------------------------------------
1624+
1625 
1626 function tab() {
1627-savepath
1628-osascript >/dev/null <<EOF
1629-on do_submenu(app_name, menu_name, menu_item, submenu_item)
1630-    -- bring the target application to the front
1631-    tell application app_name
1632-      activate
1633-    end tell
1634-    tell application "System Events"
1635-      tell process app_name
1636-        tell menu bar 1
1637-          tell menu bar item menu_name
1638-            tell menu menu_name
1639-              tell menu item menu_item
1640-                tell menu menu_item
1641-                  click menu item submenu_item
1642-                end tell
1643-              end tell
1644-            end tell
1645-          end tell
1646-        end tell
1647+  local command="cd \\\"$PWD\\\""
1648+  (( $# > 0 )) && command="${command}; $*"
1649+
1650+  the_app=$(
1651+    osascript 2>/dev/null <<EOF
1652+      tell application "System Events"
1653+        name of first item of (every process whose frontmost is true)
1654       end tell
1655-    end tell
1656-end do_submenu
1657+EOF
1658+  )
1659 
1660-do_submenu("Terminal", "Shell", "New Tab", 1)
1661+  [[ "$the_app" == 'Terminal' ]] && {
1662+    osascript 2>/dev/null <<EOF
1663+      tell application "System Events"
1664+        tell process "Terminal" to keystroke "t" using command down
1665+        tell application "Terminal" to do script "${command}" in front window
1666+      end tell
1667 EOF
1668-}
1669+  }
1670 
1671-function itab() {
1672-savepath
1673-osascript >/dev/null <<EOF
1674-on do_submenu(app_name, menu_name, menu_item)
1675-    -- bring the target application to the front
1676-    tell application app_name
1677-      activate
1678-    end tell
1679-    tell application "System Events"
1680-      tell process app_name
1681-        tell menu bar 1
1682-          tell menu bar item menu_name
1683-            tell menu menu_name
1684-              click menu item menu_item
1685-            end tell
1686+  [[ "$the_app" == 'iTerm' ]] && {
1687+    osascript 2>/dev/null <<EOF
1688+      tell application "iTerm"
1689+        set current_terminal to current terminal
1690+        tell current_terminal
1691+          launch session "Default Session"
1692+          set current_session to current session
1693+          tell current_session
1694+            write text "${command}"
1695           end tell
1696         end tell
1697       end tell
1698+EOF
1699+  }
1700+}
1701+
1702+function pfd() {
1703+  osascript 2>/dev/null <<EOF
1704+    tell application "Finder"
1705+      return POSIX path of (target of window 1 as alias)
1706     end tell
1707-end do_submenu
1708+EOF
1709+}
1710 
1711-do_submenu("iTerm", "Shell", "New Tab")
1712+function pfs() {
1713+  osascript 2>/dev/null <<EOF
1714diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh
1715index 80e33462952f42d6533b09583b5dfb00fefda1c0..8f4adca08720ffdffc8ca258637d399dcdef8e37 100644
1716--- a/plugins/phing/phing.plugin.zsh
1717+++ b/plugins/phing/phing.plugin.zsh
1718@@ -10,7 +10,6 @@ _phing_does_target_list_need_generating () {
1719 _phing () {
1720   if [ -f build.xml ]; then
1721     if _phing_does_target_list_need_generating; then
1722-      echo "\nGenerating .phing_targets..." > /dev/stderr
1723       phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets
1724     fi
1725     compadd `cat .phing_targets`