diff --git a/.zsh_plugins/README.txt b/.zsh_plugins/README.txt new file mode 100644 index 0000000..e260a65 --- /dev/null +++ b/.zsh_plugins/README.txt @@ -0,0 +1,8 @@ +#-*- coding:utf-8 -*- + +#oh-zsh-installed plugins. +'plugin name' only + +# user self installed plugins. +# added zsh in string of head. +zsh-'plugin name' diff --git a/.zsh_plugins/ant/ant.plugin.zsh b/.zsh_plugins/ant/ant.plugin.zsh new file mode 100644 index 0000000..45f2b06 --- /dev/null +++ b/.zsh_plugins/ant/ant.plugin.zsh @@ -0,0 +1,16 @@ +_ant_does_target_list_need_generating () { + [ ! -f .ant_targets ] && return 0; + [ .ant_targets -nt build.xml ] && return 0; + return 1; +} + +_ant () { + if [ -f build.xml ]; then + if _ant_does_target_list_need_generating; then + sed -n '/ .ant_targets + fi + compadd `cat .ant_targets` + fi +} + +compdef _ant ant diff --git a/.zsh_plugins/apache2-macports/apache2-macports.plugin.zsh b/.zsh_plugins/apache2-macports/apache2-macports.plugin.zsh new file mode 100644 index 0000000..1caa4cf --- /dev/null +++ b/.zsh_plugins/apache2-macports/apache2-macports.plugin.zsh @@ -0,0 +1,6 @@ +# commands to control local apache2 server installation +# paths are for osx installation via macports + +alias apache2start='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start' +alias apache2stop='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop' +alias apache2restart='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart' diff --git a/.zsh_plugins/archlinux/archlinux.plugin.zsh b/.zsh_plugins/archlinux/archlinux.plugin.zsh new file mode 100644 index 0000000..bffe965 --- /dev/null +++ b/.zsh_plugins/archlinux/archlinux.plugin.zsh @@ -0,0 +1,95 @@ +# Archlinux zsh aliases and functions +# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins + +# Look for yaourt, and add some useful functions if we have it. +if [[ -x `which yaourt` ]]; then + upgrade () { + yaourt -Syu + } + alias yaconf='yaourt -C' # Fix all configuration files with vimdiff + # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips + alias yaupg='yaourt -Syua' # Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system. + alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation + alias yain='yaourt -S' # Install specific package(s) from the repositories + alias yains='yaourt -U' # Install specific package not from the repositories but from a file + alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies + alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies + alias yarep='yaourt -Si' # Display information about a given package in the repositories + alias yareps='yaourt -Ss' # Search for package(s) in the repositories + alias yaloc='yaourt -Qi' # Display information about a given package in the local database + alias yalocs='yaourt -Qs' # Search for package(s) in the local database + alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local") + alias yaorph='yaourt -Qtd' # Remove orphans using yaourt + # Additional yaourt alias examples + if [[ -x `which abs` ]]; then + alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories + else + alias yaupd='yaourt -Sy' # Update and refresh the local package and ABS databases against repositories + fi + alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package + alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist +else + upgrade() { + sudo pacman -Syu + } +fi + +# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips +alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. +alias pacin='sudo pacman -S' # Install specific package(s) from the repositories +alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file +alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies +alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies +alias pacrep='pacman -Si' # Display information about a given package in the repositories +alias pacreps='pacman -Ss' # Search for package(s) in the repositories +alias pacloc='pacman -Qi' # Display information about a given package in the local database +alias paclocs='pacman -Qs' # Search for package(s) in the local database +# Additional pacman alias examples +if [[ -x `which abs` ]]; then + alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories +else + alias pacupd='sudo pacman -Sy' # Update and refresh the local package and ABS databases against repositories +fi +alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package +alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist + +# https://bbs.archlinux.org/viewtopic.php?id=93683 +paclist() { + 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}' +} + +alias paclsorphans='sudo pacman -Qdt' +alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' + +pacdisowned() { + tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ + db=$tmp/db + fs=$tmp/fs + + mkdir "$tmp" + trap 'rm -rf "$tmp"' EXIT + + pacman -Qlq | sort -u > "$db" + + find /bin /etc /lib /sbin /usr \ + ! -name lost+found \ + \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" + + comm -23 "$fs" "$db" +} + +pacmanallkeys() { + # Get all keys for developers and trusted users + curl https://www.archlinux.org/{developers,trustedusers}/ | + awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' | + xargs sudo pacman-key --recv-keys +} + +pacmansignkeys() { + for key in $*; do + sudo pacman-key --recv-keys $key + sudo pacman-key --lsign-key $key + printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \ + --no-permission-warning --command-fd 0 --edit-key $key + done +} diff --git a/.zsh_plugins/atom/atom.plugin.zsh b/.zsh_plugins/atom/atom.plugin.zsh new file mode 100644 index 0000000..048fd75 --- /dev/null +++ b/.zsh_plugins/atom/atom.plugin.zsh @@ -0,0 +1,4 @@ +# +# Your guess is as good as mine. Let's just assume that we will need this... +# - For more info visit... http://atom.io/ +# \ No newline at end of file diff --git a/.zsh_plugins/autoenv/autoenv.plugin.zsh b/.zsh_plugins/autoenv/autoenv.plugin.zsh new file mode 100644 index 0000000..ca56669 --- /dev/null +++ b/.zsh_plugins/autoenv/autoenv.plugin.zsh @@ -0,0 +1,18 @@ +# The use_env call below is a reusable command to activate/create a new Python +# virtualenv, requiring only a single declarative line of code in your .env files. +# It only performs an action if the requested virtualenv is not the current one. +use_env() { + typeset venv + venv="$1" + if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then + if workon | grep -q "$venv"; then + workon "$venv" + else + echo -n "Create virtualenv $venv now? (Yn) " + read answer + if [[ "$answer" == "Y" ]]; then + mkvirtualenv "$venv" + fi + fi + fi +} diff --git a/.zsh_plugins/autojump/autojump.plugin.zsh b/.zsh_plugins/autojump/autojump.plugin.zsh new file mode 100644 index 0000000..0aa1495 --- /dev/null +++ b/.zsh_plugins/autojump/autojump.plugin.zsh @@ -0,0 +1,17 @@ +if [ $commands[autojump] ]; then # check if autojump is installed + if [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package + . /usr/share/autojump/autojump.zsh + elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation + . /etc/profile.d/autojump.zsh + elif [ -f /etc/profile.d/autojump.sh ]; then # gentoo installation + . /etc/profile.d/autojump.sh + elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation + . /usr/local/share/autojump/autojump.zsh + elif [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation + . $HOME/.autojump/etc/profile.d/autojump.zsh + elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports + . /opt/local/etc/profile.d/autojump.zsh + elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew + . `brew --prefix`/etc/autojump.zsh + fi +fi diff --git a/.zsh_plugins/autopep8/_autopep8 b/.zsh_plugins/autopep8/_autopep8 new file mode 100644 index 0000000..c14d06d --- /dev/null +++ b/.zsh_plugins/autopep8/_autopep8 @@ -0,0 +1,32 @@ +#compdef autopep8 +# +# this is zsh completion function file. +# generated by genzshcomp(ver: 0.5.1) +# + +typeset -A opt_args +local context state line + +_arguments -s -S \ + "--help[show this help message and exit]:" \ + "-h[show this help message and exit]:" \ + "--version[show program's version number and exit]:" \ + "--verbose[print verbose messages; multiple -v result in more verbose messages]" \ + "-v[print verbose messages; multiple -v result in more verbose messages]" \ + "--diff[print the diff for the fixed source]" \ + "-d[print the diff for the fixed source]" \ + "--in-place[make changes to files in place]" \ + "-i[make changes to files in place]" \ + "--recursive[run recursively; must be used with --in-place or --diff]" \ + "-r[run recursively; must be used with --in-place or --diff]" \ + "--jobs[number of parallel jobs; match CPU count if value is less than 1]::n number of parallel jobs; match CPU count if value is:_files" \ + "-j[number of parallel jobs; match CPU count if value is less than 1]::n number of parallel jobs; match CPU count if value is:_files" \ + "--pep8-passes[maximum number of additional pep8 passes (default: 100)]::n:_files" \ + "-p[maximum number of additional pep8 passes (default: 100)]::n:_files" \ + "-a[-a result in more aggressive changes]::result:_files" \ + "--exclude[exclude files/directories that match these comma- separated globs]::globs:_files" \ + "--list-fixes[list codes for fixes; used by --ignore and --select]" \ + "--ignore[do not fix these errors/warnings (default E226,E24)]::errors:_files" \ + "--select[fix only these errors/warnings (e.g. E4,W)]::errors:_files" \ + "--max-line-length[set maximum allowed line length (default: 79)]::n:_files" \ + "*::args:_files" diff --git a/.zsh_plugins/autopep8/autopep8.plugin.zsh b/.zsh_plugins/autopep8/autopep8.plugin.zsh new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.zsh_plugins/autopep8/autopep8.plugin.zsh diff --git a/.zsh_plugins/battery/battery.plugin.zsh b/.zsh_plugins/battery/battery.plugin.zsh new file mode 100644 index 0000000..16ad3e6 --- /dev/null +++ b/.zsh_plugins/battery/battery.plugin.zsh @@ -0,0 +1,150 @@ +########################################### +# Battery plugin for oh-my-zsh # +# Original Author: Peter hoeg (peterhoeg) # +# Email: peter@speartail.com # +########################################### +# Author: Sean Jones (neuralsandwich) # +# Email: neuralsandwich@gmail.com # +# Modified to add support for Apple Mac # +########################################### + +if [[ $(uname) == "Darwin" ]] ; then + + function battery_pct() { + local smart_battery_status="$(ioreg -rc "AppleSmartBattery")" + typeset -F maxcapacity=$(echo $smart_battery_status | grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //') + typeset -F currentcapacity=$(echo $smart_battery_status | grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //') + integer i=$(((currentcapacity/maxcapacity) * 100)) + echo $i + } + + function battery_pct_remaining() { + if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then + battery_pct + else + echo "External Power" + fi + } + + function battery_time_remaining() { + local smart_battery_status="$(ioreg -rc "AppleSmartBattery")" + if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then + timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //') + echo "~$((timeremaining / 60)):$((timeremaining % 60))" + else + echo "∞" + fi + } + + function battery_pct_prompt () { + if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then + b=$(battery_pct_remaining) + if [ $b -gt 50 ] ; then + color='green' + elif [ $b -gt 20 ] ; then + color='yellow' + else + color='red' + fi + echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}" + else + echo "∞" + fi + } + + function battery_is_charging() { + [[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]] + } + +elif [[ $(uname) == "Linux" ]] ; then + + function battery_pct_remaining() { + if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then + echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" + fi + } + + function battery_time_remaining() { + if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then + echo $(acpi | cut -f3 -d ',') + fi + } + + function battery_pct_prompt() { + b=$(battery_pct_remaining) + if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then + if [ $b -gt 50 ] ; then + color='green' + elif [ $b -gt 20 ] ; then + color='yellow' + else + color='red' + fi + echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}" + else + echo "∞" + fi + } + + function battery_pct() { + # todo for on linux + } + + function battery_is_charging() { + # todo on linux + false + } + +else + # Empty functions so we don't cause errors in prompts + function battery_pct_remaining() { + } + + function battery_time_remaining() { + } + + function battery_pct_prompt() { + } +fi + +function battery_level_gauge() { + local gauge_slots=${BATTERY_GAUGE_SLOTS:-10}; + local green_threshold=${BATTERY_GREEN_THRESHOLD:-6}; + local yellow_threshold=${BATTERY_YELLOW_THRESHOLD:-4}; + local color_green=${BATTERY_COLOR_GREEN:-%F{green}}; + local color_yellow=${BATTERY_COLOR_YELLOW:-%F{yellow}}; + local color_red=${BATTERY_COLOR_RED:-%F{red}}; + local color_reset=${BATTERY_COLOR_RESET:-%{%f%k%b%}}; + local battery_prefix=${BATTERY_GAUGE_PREFIX:-'['}; + local battery_suffix=${BATTERY_GAUGE_SUFFIX:-']'}; + local filled_symbol=${BATTERY_GAUGE_FILLED_SYMBOL:-'▶'}; + local empty_symbol=${BATTERY_GAUGE_EMPTY_SYMBOL:-'▷'}; + local charging_color=${BATTERY_CHARGING_COLOR:-$color_yellow}; + local charging_symbol=${BATTERY_CHARGING_SYMBOL:-'⚡'}; + + local battery_remaining_percentage=$(battery_pct); + + if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then + local filled=$(((( $battery_remaining_percentage + $gauge_slots - 1) / $gauge_slots))); + local empty=$(($gauge_slots - $filled)); + + if [[ $filled -gt $green_threshold ]]; then local gauge_color=$color_green; + elif [[ $filled -gt $yellow_threshold ]]; then local gauge_color=$color_yellow; + else local gauge_color=$color_red; + fi + else + local filled=$gauge_slots; + local empty=0; + filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'}; + fi + + + local charging=' ' && battery_is_charging && charging=$charging_symbol; + + printf ${charging_color//\%/\%\%}$charging${color_reset//\%/\%\%}${battery_prefix//\%/\%\%}${gauge_color//\%/\%\%} + printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled} + [[ $filled -lt $gauge_slots ]] && printf ${empty_symbol//\%/\%\%}'%.0s' {1..$empty} + printf ${color_reset//\%/\%\%}${battery_suffix//\%/\%\%}${color_reset//\%/\%\%} +} + + diff --git a/.zsh_plugins/bower/_bower b/.zsh_plugins/bower/_bower new file mode 100644 index 0000000..ae0ca4a --- /dev/null +++ b/.zsh_plugins/bower/_bower @@ -0,0 +1,58 @@ + + +# Credits to npm's awesome completion utility. +# +# Bower completion script, based on npm completion script. + +###-begin-bower-completion-### +# +# Installation: bower completion >> ~/.bashrc (or ~/.zshrc) +# Or, maybe: bower completion > /usr/local/etc/bash_completion.d/bower +# + +COMP_WORDBREAKS=${COMP_WORDBREAKS/=/} +COMP_WORDBREAKS=${COMP_WORDBREAKS/@/} +export COMP_WORDBREAKS + +if type complete &>/dev/null; then + _bower_completion () { + local si="$IFS" + IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \ + COMP_LINE="$COMP_LINE" \ + COMP_POINT="$COMP_POINT" \ + bower completion -- "${COMP_WORDS[@]}" \ + 2>/dev/null)) || return $? + IFS="$si" + } + complete -F _bower_completion bower +elif type compdef &>/dev/null; then + _bower_completion() { + si=$IFS + compadd -- $(COMP_CWORD=$((CURRENT-1)) \ + COMP_LINE=$BUFFER \ + COMP_POINT=0 \ + bower completion -- "${words[@]}" \ + 2>/dev/null) + IFS=$si + } + compdef _bower_completion bower +elif type compctl &>/dev/null; then + _bower_completion () { + local cword line point words si + read -Ac words + read -cn cword + let cword-=1 + read -l line + read -ln point + si="$IFS" + IFS=$'\n' reply=($(COMP_CWORD="$cword" \ + COMP_LINE="$line" \ + COMP_POINT="$point" \ + bower completion -- "${words[@]}" \ + 2>/dev/null)) || return $? + IFS="$si" + } + compctl -K _bower_completion bower +fi +###-end-bower-completion-### + diff --git a/.zsh_plugins/bower/bower.plugin.zsh b/.zsh_plugins/bower/bower.plugin.zsh new file mode 100644 index 0000000..68a67a3 --- /dev/null +++ b/.zsh_plugins/bower/bower.plugin.zsh @@ -0,0 +1,81 @@ +alias bi="bower install" +alias bl="bower list" +alias bs="bower search" + +_bower_installed_packages () { + bower_package_list=$(bower ls --no-color 2>/dev/null| awk 'NR>3{print p}{p=$0}'| cut -d ' ' -f 2|sed 's/#.*//') +} +_bower () +{ + local -a _1st_arguments _no_color _dopts _save_dev _force_lastest _production + local expl + typeset -A opt_args + + _no_color=('--no-color[Do not print colors (available in all commands)]') + + _dopts=( + '(--save)--save[Save installed packages into the project"s bower.json dependencies]' + '(--force)--force[Force fetching remote resources even if a local copy exists on disk]' + ) + + _save_dev=('(--save-dev)--save-dev[Save installed packages into the project"s bower.json devDependencies]') + + _force_lastest=('(--force-latest)--force-latest[Force latest version on conflict]') + + _production=('(--production)--production[Do not install project devDependencies]') + + _1st_arguments=( + 'cache-clean:Clean the Bower cache, or the specified package caches' \ + 'help:Display help information about Bower' \ + 'info:Version info and description of a particular package' \ + 'init:Interactively create a bower.json file' \ + 'install:Install a package locally' \ + 'link:Symlink a package folder' \ + 'lookup:Look up a package URL by name' \ + 'register:Register a package' \ + 'search:Search for a package by name' \ + 'uninstall:Remove a package' \ + 'update:Update a package' \ + {ls,list}:'[List all installed packages]' + ) + _arguments \ + $_no_color \ + '*:: :->subcmds' && return 0 + + if (( CURRENT == 1 )); then + _describe -t commands "bower subcommand" _1st_arguments + return + fi + + case "$words[1]" in + install) + _arguments \ + $_dopts \ + $_save_dev \ + $_force_lastest \ + $_no_color \ + $_production + ;; + update) + _arguments \ + $_dopts \ + $_no_color \ + $_force_lastest + _bower_installed_packages + compadd "$@" $(echo $bower_package_list) + ;; + uninstall) + _arguments \ + $_no_color \ + $_dopts + _bower_installed_packages + compadd "$@" $(echo $bower_package_list) + ;; + *) + $_no_color \ + ;; + esac + +} + +compdef _bower bower diff --git a/.zsh_plugins/brew/_brew b/.zsh_plugins/brew/_brew new file mode 100644 index 0000000..d4306f2 --- /dev/null +++ b/.zsh_plugins/brew/_brew @@ -0,0 +1,84 @@ +#compdef brew +#autoload + +# imported from the latest homebrew contributions + +_brew_all_formulae() { + formulae=(`brew search`) +} + +_brew_installed_formulae() { + installed_formulae=(`brew list`) +} + +local -a _1st_arguments +_1st_arguments=( + 'cat:display formula file for a formula' + 'cleanup:uninstall unused and old versions of packages' + 'create:create a new formula' + 'deps:list dependencies and dependants of a formula' + 'doctor:audits your installation for common issues' + 'edit:edit a formula' + 'home:visit the homepage of a formula or the brew project' + 'info:information about a formula' + 'install:install a formula' + 'link:link a formula' + 'list:list files in a formula or not-installed formulae' + 'log:git commit log for a formula' + 'missing:check all installed formuale for missing dependencies.' + 'options:display install options specific to formula.' + 'outdated:list formulas for which a newer version is available' + 'prune:remove dead links' + 'reinstall:reinstall a formula' + 'remove:remove a formula' + 'search:search for a formula (/regex/ or string)' + 'server:start a local web app that lets you browse formulae (requires Sinatra)' + 'services:manage background services via launchctl' + 'unlink:unlink a formula' + 'update:freshen up links' + 'upgrade:upgrade outdated formulae' + 'uses:show formulas which depend on a formula' + 'versions:show all available formula versions' +) + +local expl +local -a formulae installed_formulae + +_arguments \ + '(-v)-v[verbose]' \ + '(--cellar)--cellar[brew cellar]' \ + '(--config)--config[brew configuration]' \ + '(--env)--env[brew environment]' \ + '(--repository)--repository[brew repository]' \ + '(--version)--version[version information]' \ + '(--prefix)--prefix[where brew lives on this system]' \ + '(--cache)--cache[brew cache]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "brew subcommand" _1st_arguments + return +fi + +case "$words[1]" in + search|-S) + _arguments \ + '(--macports)--macports[search the macports repository]' \ + '(--fink)--fink[search the fink repository]' ;; + list|ls) + _arguments \ + '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ + '(--versions)--versions[list all installed versions of a formula]' \ + '1: :->forms' && return 0 + + if [[ "$state" == forms ]]; then + _brew_installed_formulae + _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae + fi ;; + install|home|homepage|log|info|abv|uses|cat|deps|edit|options|versions) + _brew_all_formulae + _wanted formulae expl 'all formulae' compadd -a formulae ;; + reinstall|remove|rm|uninstall|unlink|cleanup|link|ln) + _brew_installed_formulae + _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; +esac diff --git a/.zsh_plugins/brew/brew.plugin.zsh b/.zsh_plugins/brew/brew.plugin.zsh new file mode 100644 index 0000000..c2e9588 --- /dev/null +++ b/.zsh_plugins/brew/brew.plugin.zsh @@ -0,0 +1 @@ +alias brews='brew list -1' diff --git a/.zsh_plugins/bundler/_bundler b/.zsh_plugins/bundler/_bundler new file mode 100644 index 0000000..2ec3a5f --- /dev/null +++ b/.zsh_plugins/bundler/_bundler @@ -0,0 +1,91 @@ +#compdef bundle + +local curcontext="$curcontext" state line _gems _opts ret=1 + +_arguments -C -A "-v" -A "--version" \ + '(- 1 *)'{-v,--version}'[display version information]' \ + '1: :->cmds' \ + '*:: :->args' && ret=0 + +case $state in + cmds) + _values "bundle command" \ + "install[Install the gems specified by the Gemfile or Gemfile.lock]" \ + "update[Update dependencies to their latest versions]" \ + "package[Package the .gem files required by your application]" \ + "exec[Execute a script in the context of the current bundle]" \ + "config[Specify and read configuration options for bundler]" \ + "check[Determine whether the requirements for your application are installed]" \ + "list[Show all of the gems in the current bundle]" \ + "show[Show the source location of a particular gem in the bundle]" \ + "console[Start an IRB session in the context of the current bundle]" \ + "open[Open an installed gem in the editor]" \ + "viz[Generate a visual representation of your dependencies]" \ + "init[Generate a simple Gemfile, placed in the current directory]" \ + "gem[Create a simple gem, suitable for development with bundler]" \ + "clean[Cleans up unused gems in your bundler directory]" \ + "help[Describe available tasks or one specific task]" + ret=0 + ;; + args) + case $line[1] in + help) + _values 'commands' \ + 'install' \ + 'update' \ + 'package' \ + 'exec' \ + 'config' \ + 'check' \ + 'list' \ + 'show' \ + 'console' \ + 'open' \ + 'viz' \ + 'init' \ + 'gem' \ + 'help' && ret=0 + ;; + install) + _arguments \ + '(--no-color)--no-color[disable colorization in output]' \ + '(--local)--local[do not attempt to connect to rubygems.org]' \ + '(--quiet)--quiet[only output warnings and errors]' \ + '(--gemfile)--gemfile=-[use the specified gemfile instead of Gemfile]:gemfile' \ + '(--system)--system[install to the system location]' \ + '(--deployment)--deployment[install using defaults tuned for deployment environments]' \ + '(--frozen)--frozen[do not allow the Gemfile.lock to be updated after this install]' \ + '(--path)--path=-[specify a different path than the system default]:path:_files' \ + '(--binstubs)--binstubs=-[generate bin stubs for bundled gems to ./bin]:directory:_files' \ + '(--without)--without=-[exclude gems that are part of the specified named group]:groups' + ret=0 + ;; + exec) + _normal && ret=0 + ;; + clean) + _arguments \ + '(--force)--force[forces clean even if --path is not set]' \ + '(--dry-run)--dry-run[only print out changes, do not actually clean gems]' \ + '(--no-color)--no-color[Disable colorization in output]' \ + '(--verbose)--verbose[Enable verbose output mode]' + ret=0 + ;; + (open|show) + _gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') ) + if [[ $_gems != "" ]]; then + _values 'gems' $_gems && ret=0 + fi + ;; + *) + _opts=( $(bundle help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') ) + _opts+=( $(bundle help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') ) + if [[ $_opts != "" ]]; then + _values 'options' $_opts && ret=0 + fi + ;; + esac + ;; +esac + +return ret diff --git a/.zsh_plugins/bundler/bundler.plugin.zsh b/.zsh_plugins/bundler/bundler.plugin.zsh new file mode 100644 index 0000000..9dfed61 --- /dev/null +++ b/.zsh_plugins/bundler/bundler.plugin.zsh @@ -0,0 +1,68 @@ +alias be="bundle exec" +alias bl="bundle list" +alias bp="bundle package" +alias bo="bundle open" +alias bu="bundle update" + +# The following is based on https://github.com/gma/bundler-exec + +bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard jekyll kitchen knife middleman nanoc rackup rainbows rake rspec ruby shotgun spec spin spork strainer tailor taps thin thor unicorn unicorn_rails puma) + +# Remove $UNBUNDLED_COMMANDS from the bundled_commands list +for cmd in $UNBUNDLED_COMMANDS; do + bundled_commands=(${bundled_commands#$cmd}); +done + +## Functions + +bi() { + if _bundler-installed && _within-bundled-project; then + local bundler_version=`bundle version | cut -d' ' -f3` + if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then + if [[ "$(uname)" == 'Darwin' ]] + then + local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" + else + local cores_num="$(nproc)" + fi + bundle install --jobs=$cores_num $@ + else + bundle install $@ + fi + else + echo "Can't 'bundle install' outside a bundled project" + fi +} + +_bundler-installed() { + which bundle > /dev/null 2>&1 +} + +_within-bundled-project() { + local check_dir=$PWD + while [ $check_dir != "/" ]; do + [ -f "$check_dir/Gemfile" ] && return + check_dir="$(dirname $check_dir)" + done + false +} + +_run-with-bundler() { + if _bundler-installed && _within-bundled-project; then + bundle exec $@ + else + $@ + fi +} + +## Main program +for cmd in $bundled_commands; do + eval "function unbundled_$cmd () { $cmd \$@ }" + eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" + alias $cmd=bundled_$cmd + + if which _$cmd > /dev/null 2>&1; then + compdef _$cmd bundled_$cmd=$cmd + fi +done + diff --git a/.zsh_plugins/bwana/bwana.plugin.zsh b/.zsh_plugins/bwana/bwana.plugin.zsh new file mode 100644 index 0000000..455da86 --- /dev/null +++ b/.zsh_plugins/bwana/bwana.plugin.zsh @@ -0,0 +1,13 @@ +# +# Requires http://www.bruji.com/bwana/ +# +if [[ -e /Applications/Bwana.app ]] || + ( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana ) +then + function man() { + open "man:$1" + } +else + echo "Bwana lets you read man files in Safari through a man: URI scheme" + echo "To use it within Zsh, install it from http://www.bruji.com/bwana/" +fi diff --git a/.zsh_plugins/cabal/cabal.plugin.zsh b/.zsh_plugins/cabal/cabal.plugin.zsh new file mode 100644 index 0000000..9f76add --- /dev/null +++ b/.zsh_plugins/cabal/cabal.plugin.zsh @@ -0,0 +1,47 @@ +function cabal_sandbox_info() { + cabal_files=(*.cabal(N)) + if [ $#cabal_files -gt 0 ]; then + if [ -f cabal.sandbox.config ]; then + echo "%{$fg[green]%}sandboxed%{$reset_color%}" + else + echo "%{$fg[red]%}not sandboxed%{$reset_color%}" + fi + fi +} + +function _cabal_commands() { + local ret=1 state + _arguments ':subcommand:->subcommand' && ret=0 + + case $state in + subcommand) + subcommands=( + "bench:Run the benchmark, if any (configure with UserHooks)" + "build:Make this package ready for installation" + "check:Check the package for common mistakes" + "clean:Clean up after a build" + "copy:Copy teh files into the install locations" + "configure:Prepare to build the package" + "fetch:Downloads packages for later installation" + "haddock:Generate HAddock HTML documentation" + "help:Help about commands" + "hscolour:Generate HsColour colourised code, in HTML format" + "info:Display detailed information about a particular package" + "init:Interactively create a .cabal file" + "install:Installs a list of packages" + "list:List packages matching a search string" + "register:Register this package with the compiler" + "report:Upload build reports to a remote server" + "sdist:Generate a source distribution file (.tar.gz)" + "test:Run the test suite, if any (configure with UserHooks)" + "unpack:Unpacks packages for user inspection" + "update:Updates list of known packages" + "upload:Uploads source packages to Hackage" + ) + _describe -t subcommands 'cabal subcommands' subcommands && ret=0 + esac + + return ret +} + +compdef _cabal_commands cabal diff --git a/.zsh_plugins/cake/cake.plugin.zsh b/.zsh_plugins/cake/cake.plugin.zsh new file mode 100644 index 0000000..44cc474 --- /dev/null +++ b/.zsh_plugins/cake/cake.plugin.zsh @@ -0,0 +1,33 @@ +# Set this to 1 if you want to cache the tasks +_cake_cache_task_list=1 + +# Cache filename +_cake_task_cache_file='.cake_task_cache' + +_cake_get_target_list () { + cake | grep '^cake ' | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$' +} + +_cake_does_target_list_need_generating () { + + if [ ${_cake_cache_task_list} -eq 0 ]; then + return 1; + fi + + [ ! -f ${_cake_task_cache_file} ] && return 0; + [ ${_cake_task_cache_file} -nt Cakefile ] && return 0; + return 1; +} + +_cake () { + if [ -f Cakefile ]; then + if _cake_does_target_list_need_generating; then + _cake_get_target_list > ${_cake_task_cache_file} + compadd `cat ${_cake_task_cache_file}` + else + compadd `_cake_get_target_list` + fi + fi +} + +compdef _cake cake diff --git a/.zsh_plugins/capistrano/_capistrano b/.zsh_plugins/capistrano/_capistrano new file mode 100644 index 0000000..3cadf3d --- /dev/null +++ b/.zsh_plugins/capistrano/_capistrano @@ -0,0 +1,10 @@ +#compdef cap +#autoload + +if [[ -f config/deploy.rb || -f Capfile ]]; then + if [[ ! -f .cap_tasks~ || config/deploy.rb -nt .cap_tasks~ ]]; then + echo "\nGenerating .cap_tasks~..." > /dev/stderr + cap -v --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~ + fi + compadd `cat .cap_tasks~` +fi diff --git a/.zsh_plugins/catimg/catimg.plugin.zsh b/.zsh_plugins/catimg/catimg.plugin.zsh new file mode 100644 index 0000000..cb92f59 --- /dev/null +++ b/.zsh_plugins/catimg/catimg.plugin.zsh @@ -0,0 +1,17 @@ +################################################################################ +# catimg script by Eduardo San Martin Morote aka Posva # +# http://posva.net # +# # +# Ouput the content of an image to the stdout using the 256 colors of the # +# terminal. # +# Github: https://github.com/posva/catimg # +################################################################################ + + +function catimg() { + if [[ -x `which convert` ]]; then + zsh $ZSH/plugins/catimg/catimg.sh $@ + else + echo "catimg need convert (ImageMagick) to work)" + fi +} diff --git a/.zsh_plugins/catimg/catimg.sh b/.zsh_plugins/catimg/catimg.sh new file mode 100644 index 0000000..cd0f2e3 --- /dev/null +++ b/.zsh_plugins/catimg/catimg.sh @@ -0,0 +1,88 @@ +################################################################################ +# catimg script by Eduardo San Martin Morote aka Posva # +# http://posva.net # +# # +# Ouput the content of an image to the stdout using the 256 colors of the # +# terminal. # +# Github: https://github.com/posva/catimg # +################################################################################ + +function help() { + echo "Usage catimg [-h] [-w width] [-c char] img" + echo "By default char is \" \" and w is the terminal width" +} + +# VARIABLES +COLOR_FILE=$(dirname $0)/colors.png +CHAR=" " + +WIDTH="" +IMG="" + +while getopts qw:c:h opt; do + case "$opt" in + w) WIDTH="$OPTARG" ;; + c) CHAR="$OPTARG" ;; + h) help; exit ;; + *) help ; exit 1;; + esac + done + +while [ "$1" ]; do + IMG="$1" + shift +done + +if [ "$IMG" = "" -o ! -f "$IMG" ]; then + help + exit 1 +fi + +if [ ! "$WIDTH" ]; then + COLS=$(expr $(tput cols) "/" $(echo -n "$CHAR" | wc -c)) +else + COLS=$(expr $WIDTH "/" $(echo -n "$CHAR" | wc -c)) +fi +WIDTH=$(convert "$IMG" -print "%w\n" /dev/null) +if [ "$WIDTH" -gt "$COLS" ]; then + WIDTH=$COLS +fi + +REMAP="" +if convert "$IMG" -resize $COLS\> +dither -remap $COLOR_FILE /dev/null ; then + REMAP="-remap $COLOR_FILE" +else + echo "The version of convert is too old, don't expect good results :(" >&2 + #convert "$IMG" -colors 256 PNG8:tmp.png + #IMG="tmp.png" +fi + +# Display the image +I=0 +convert "$IMG" -resize $COLS\> +dither `echo $REMAP` txt:- 2>/dev/null | +sed -e 's/.*none.*/NO NO NO/g' -e '1d;s/^.*(\(.*\)[,)].*$/\1/g;y/,/ /' | +while read R G B f; do + if [ ! "$R" = "NO" ]; then + if [ "$R" -eq "$G" -a "$G" -eq "$B" ]; then + (( + I++, + IDX = 232 + R * 23 / 255 + )) + else + (( + I++, + IDX = 16 + + R * 5 / 255 * 36 + + G * 5 / 255 * 6 + + B * 5 / 255 + )) + fi + #echo "$R,$G,$B: $IDX" + echo -ne "\e[48;5;${IDX}m${CHAR}" + else + (( I++ )) + echo -ne "\e[0m${CHAR}" + fi + # New lines + (( $I % $WIDTH )) || echo -e "\e[0m" +done diff --git a/.zsh_plugins/catimg/colors.png b/.zsh_plugins/catimg/colors.png new file mode 100644 index 0000000..5f2c812 --- /dev/null +++ b/.zsh_plugins/catimg/colors.png Binary files differ diff --git a/.zsh_plugins/celery/_celery b/.zsh_plugins/celery/_celery new file mode 100644 index 0000000..63af9fa --- /dev/null +++ b/.zsh_plugins/celery/_celery @@ -0,0 +1,129 @@ +#compdef celery +#autoload + +#celery zsh completion + +_celery () { +local -a _1st_arguments ifargs dopts controlargs + +typeset -A opt_args + +_1st_arguments=('worker' 'events' 'beat' 'shell' 'multi' 'amqp' 'status' 'inspect' \ + 'control' 'purge' 'list' 'migrate' 'call' 'result' 'report') +ifargs=('--app=' '--broker=' '--loader=' '--config=' '--version') +dopts=('--detach' '--umask=' '--gid=' '--uid=' '--pidfile=' '--logfile=' '--loglevel=') +controlargs=('--timeout' '--destination') +_arguments \ + '(-A --app=)'{-A,--app}'[app instance to use (e.g. module.attr_name):APP]' \ + '(-b --broker=)'{-b,--broker}'[url to broker. default is "amqp://guest@localhost//":BROKER]' \ + '(--loader)--loader[name of custom loader class to use.:LOADER]' \ + '(--config)--config[Name of the configuration module:CONFIG]' \ + '(--workdir)--workdir[Optional directory to change to after detaching.:WORKING_DIRECTORY]' \ + '(-q --quiet)'{-q,--quiet}'[Don"t show as much output.]' \ + '(-C --no-color)'{-C,--no-color}'[Don"t display colors.]' \ + '(--version)--version[show program"s version number and exit]' \ + '(- : *)'{-h,--help}'[show this help message and exit]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "celery subcommand" _1st_arguments + return +fi + +case "$words[1]" in + worker) + _arguments \ + '(-C --concurrency=)'{-C,--concurrency=}'[Number of child processes processing the queue. The default is the number of CPUs.]' \ + '(--pool)--pool=:::(processes eventlet gevent threads solo)' \ + '(--purge --discard)'{--discard,--purge}'[Purges all waiting tasks before the daemon is started.]' \ + '(-f --logfile=)'{-f,--logfile=}'[Path to log file. If no logfile is specified, stderr is used.]' \ + '(--loglevel=)--loglevel=:::(critical error warning info debug)' \ + '(-N --hostname=)'{-N,--hostname=}'[Set custom hostname, e.g. "foo.example.com".]' \ + '(-B --beat)'{-B,--beat}'[Also run the celerybeat periodic task scheduler.]' \ + '(-s --schedule=)'{-s,--schedule=}'[Path to the schedule database if running with the -B option. Defaults to celerybeat-schedule.]' \ + '(-S --statedb=)'{-S,--statedb=}'[Path to the state database.Default: None]' \ + '(-E --events)'{-E,--events}'[Send events that can be captured by monitors like celeryev, celerymon, and others.]' \ + '(--time-limit=)--time-limit=[nables a hard time limit (in seconds int/float) for tasks]' \ + '(--soft-time-limit=)--soft-time-limit=[Enables a soft time limit (in seconds int/float) for tasks]' \ + '(--maxtasksperchild=)--maxtasksperchild=[Maximum number of tasks a pool worker can execute before it"s terminated and replaced by a new worker.]' \ + '(-Q --queues=)'{-Q,--queues=}'[List of queues to enable for this worker, separated by comma. By default all configured queues are enabled.]' \ + '(-I --include=)'{-I,--include=}'[Comma separated list of additional modules to import.]' \ + '(--pidfile=)--pidfile=[Optional file used to store the process pid.]' \ + '(--autoscale=)--autoscale=[Enable autoscaling by providing max_concurrency, min_concurrency.]' \ + '(--autoreload)--autoreload[Enable autoreloading.]' \ + '(--no-execv)--no-execv[Don"t do execv after multiprocessing child fork.]' + compadd -a ifargs + ;; + inspect) + _values -s \ + 'active[dump active tasks (being processed)]' \ + 'active_queues[dump queues being consumed from]' \ + 'ping[ping worker(s)]' \ + 'registered[dump of registered tasks]' \ + 'report[get bugreport info]' \ + 'reserved[dump reserved tasks (waiting to be processed)]' \ + 'revoked[dump of revoked task ids]' \ + 'scheduled[dump scheduled tasks (eta/countdown/retry)]' \ + 'stats[dump worker statistics]' + compadd -a controlargs ifargs + ;; + control) + _values -s \ + 'add_consumer[tell worker(s) to start consuming a queue]' \ + 'autoscale[change autoscale settings]' \ + 'cancel_consumer[tell worker(s) to stop consuming a queue]' \ + 'disable_events[tell worker(s) to disable events]' \ + 'enable_events[tell worker(s) to enable events]' \ + 'pool_grow[start more pool processes]' \ + 'pool_shrink[use less pool processes]' \ + 'rate_limit[tell worker(s) to modify the rate limit for a task type]' \ + 'time_limit[tell worker(s) to modify the time limit for a task type.]' + compadd -a controlargs ifargs + ;; + multi) + _values -s \ + '--nosplash[Don"t display program info.]' \ + '--verbose[Show more output.]' \ + '--no-color[Don"t display colors.]' \ + '--quiet[Don"t show as much output.]' \ + 'start' 'restart' 'stopwait' 'stop' 'show' \ + 'names' 'expand' 'get' 'kill' + compadd -a ifargs + ;; + amqp) + _values -s \ + 'queue.declare' 'queue.purge' 'exchange.delete' 'basic.publish' \ + 'exchange.declare' 'queue.delete' 'queue.bind' 'basic.get' + ;; + list) + _values -s, 'bindings' + ;; + shell) + _values -s \ + '--ipython[force iPython.]' \ + '--bpython[force bpython.]' \ + '--python[force default Python shell.]' \ + '--without-tasks[don"t add tasks to locals.]' \ + '--eventlet[use eventlet.]' \ + '--gevent[use gevent.]' + compadd -a ifargs + ;; + beat) + _arguments \ + '(-s --schedule=)'{-s,--schedule=}'[Path to the schedule database. Defaults to celerybeat-schedule.]' \ + '(-S --scheduler=)'{-S,--scheduler=}'[Scheduler class to use. Default is celery.beat.PersistentScheduler.]' \ + '(--max-interval)--max-interval[]' + compadd -a dopts fargs + ;; + events) + _arguments \ + '(-d --dump)'{-d,--dump}'[Dump events to stdout.]' \ + '(-c --camera=)'{-c,--camera=}'[Take snapshots of events using this camera.]' \ + '(-F --frequency=)'{-F,--frequency=}'[Camera: Shutter frequency. Default is every 1.0 seconds.]' \ + '(-r --maxrate=)'{-r,--maxrate=}'[Camera: Optional shutter rate limit (e.g. 10/m).]' + compadd -a dopts fargs + ;; + *) + ;; + esac +} diff --git a/.zsh_plugins/chruby/chruby.plugin.zsh b/.zsh_plugins/chruby/chruby.plugin.zsh new file mode 100644 index 0000000..2a2c80c --- /dev/null +++ b/.zsh_plugins/chruby/chruby.plugin.zsh @@ -0,0 +1,99 @@ +# +# INSTRUCTIONS +# +# With either a manual or brew installed chruby things should just work. +# +# If you'd prefer to specify an explicit path to load chruby from +# you can set variables like so: +# +# zstyle :omz:plugins:chruby path /local/path/to/chruby.sh +# zstyle :omz:plugins:chruby auto /local/path/to/auto.sh +# +# TODO +# - autodetermine correct source path on non OS X systems +# - completion if ruby-install exists + +# rvm and rbenv plugins also provide this alias +alias rubies='chruby' + +local _chruby_path +local _chruby_auto + +_homebrew-installed() { + whence brew &> /dev/null +} + +_chruby-from-homebrew-installed() { + brew --prefix chruby &> /dev/null +} + +_ruby-build_installed() { + whence ruby-build &> /dev/null +} + +_ruby-install-installed() { + whence ruby-install &> /dev/null +} + +# Simple definition completer for ruby-build +if _ruby-build_installed; then + _ruby-build() { compadd $(ruby-build --definitions) } + compdef _ruby-build ruby-build +fi + +_source_from_omz_settings() { + zstyle -s :omz:plugins:chruby path _chruby_path + zstyle -s :omz:plugins:chruby auto _chruby_auto + + if _chruby_path && [[ -r _chruby_path ]]; then + source ${_chruby_path} + fi + + if _chruby_auto && [[ -r _chruby_auto ]]; then + source ${_chruby_auto} + fi +} + +_chruby_dirs() { + chrubydirs=($HOME/.rubies/ $PREFIX/opt/rubies) + for dir in chrubydirs; do + if [[ -d $dir ]]; then + RUBIES+=$dir + fi + done +} + +if _homebrew-installed && _chruby-from-homebrew-installed ; then + source $(brew --prefix chruby)/share/chruby/chruby.sh + source $(brew --prefix chruby)/share/chruby/auto.sh + _chruby_dirs +elif [[ -r "/usr/local/share/chruby/chruby.sh" ]] ; then + source /usr/local/share/chruby/chruby.sh + source /usr/local/share/chruby/auto.sh + _chruby_dirs +else + _source_from_omz_settings + _chruby_dirs +fi + +function ensure_chruby() { + $(whence chruby) +} + +function current_ruby() { + local _ruby + _ruby="$(chruby |grep \* |tr -d '* ')" + if [[ $(chruby |grep -c \*) -eq 1 ]]; then + echo ${_ruby} + else + echo "system" + fi +} + +function chruby_prompt_info() { + echo "$(current_ruby)" +} + +# complete on installed rubies +_chruby() { compadd $(chruby | tr -d '* ') } +compdef _chruby chruby diff --git a/.zsh_plugins/cloudapp/cloudapp.plugin.zsh b/.zsh_plugins/cloudapp/cloudapp.plugin.zsh new file mode 100644 index 0000000..99252f6 --- /dev/null +++ b/.zsh_plugins/cloudapp/cloudapp.plugin.zsh @@ -0,0 +1,2 @@ +#!/bin/zsh +alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb diff --git a/.zsh_plugins/cloudapp/cloudapp.rb b/.zsh_plugins/cloudapp/cloudapp.rb new file mode 100644 index 0000000..a11cfdb --- /dev/null +++ b/.zsh_plugins/cloudapp/cloudapp.rb @@ -0,0 +1,60 @@ +#!/usr/bin/env ruby +# +# cloudapp +# Zach Holman / @holman +# +# Uploads a file from the command line to CloudApp, drops it into your +# clipboard (on a Mac, at least). +# +# Example: +# +# cloudapp drunk-blake.png +# +# This requires Aaron Russell's cloudapp_api gem: +# +# gem install cloudapp_api +# +# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of: +# +# email +# password + +require 'rubygems' +begin + require 'cloudapp_api' +rescue LoadError + puts "You need to install cloudapp_api: gem install cloudapp_api" + exit!(1) +end + +config_file = "#{ENV['HOME']}/.cloudapp" +unless File.exist?(config_file) + puts "You need to type your email and password (one per line) into "+ + "`~/.cloudapp`" + exit!(1) +end + +email,password = File.read(config_file).split("\n") + +class HTTParty::Response + # Apparently HTTPOK.ok? IS NOT OKAY WTFFFFFFFFFFUUUUUUUUUUUUUU + # LETS MONKEY PATCH IT I FEEL OKAY ABOUT IT + def ok? ; true end +end + +if ARGV[0].nil? + puts "You need to specify a file to upload." + exit!(1) +end + +CloudApp.authenticate(email,password) +url = CloudApp::Item.create(:upload, {:file => ARGV[0]}).url + +# Say it for good measure. +puts "Uploaded to #{url}." + +# Get the embed link. +url = "#{url}/#{ARGV[0].split('/').last}" + +# Copy it to your (Mac's) clipboard. +`echo '#{url}' | tr -d "\n" | pbcopy` diff --git a/.zsh_plugins/coffee/_coffee b/.zsh_plugins/coffee/_coffee new file mode 100644 index 0000000..10b6b81 --- /dev/null +++ b/.zsh_plugins/coffee/_coffee @@ -0,0 +1,81 @@ +#compdef coffee +# ------------------------------------------------------------------------------ +# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for Coffee.js v0.6.11 (http://coffeejs.org) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Mario Fernandez (https://github.com/sirech) +# * Dong Weiming (https://github.com/dongweiming) +# +# ------------------------------------------------------------------------------ + +local curcontext="$curcontext" state line ret=1 version opts first second third +typeset -A opt_args +version=(${(f)"$(_call_program version $words[1] --version)"}) +version=${${(z)${version[1]}}[3]} +first=$(echo $version|cut -d '.' -f 1) +second=$(echo $version|cut -d '.' -f 2) +third=$(echo $version|cut -d '.' -f 3) +if (( $first < 2 )) && (( $second < 7 )) && (( $third < 3 ));then + opts+=('(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]' + '(-r --require)'{-r,--require}'[require a library before executing your script]:library') +fi + + +_arguments -C \ + '(- *)'{-h,--help}'[display this help message]' \ + '(- *)'{-v,--version}'[display the version number]' \ + $opts \ + '(-b --bare)'{-b,--bare}'[compile without a top-level function wrapper]' \ + '(-e --eval)'{-e,--eval}'[pass a string from the command line as input]:Inline Script' \ + '(-i --interactive)'{-i,--interactive}'[run an interactive CoffeeScript REPL]' \ + '(-j --join)'{-j,--join}'[concatenate the source CoffeeScript before compiling]:Destination JS file:_files -g "*.js"' \ + '(--nodejs)--nodejs[pass options directly to the "node" binary]' \ + '(-c --compile)'{-c,--compile}'[compile to JavaScript and save as .js files]' \ + '(-o --output)'{-o,--output}'[set the output directory for compiled JavaScript]:Output Directory:_files -/' \ + '(-n -t -p)'{-n,--nodes}'[print out the parse tree that the parser produces]' \ + '(-n -t -p)'{-p,--print}'[print out the compiled JavaScript]' \ + '(-n -t -p)'{-t,--tokens}'[print out the tokens that the lexer/rewriter produce]' \ + '(-s --stdio)'{-s,--stdio}'[listen for and compile scripts over stdio]' \ + '(-w --watch)'{-w,--watch}'[watch scripts for changes and rerun commands]' \ + '*:script or directory:_files' && ret=0 + +return ret + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et diff --git a/.zsh_plugins/colemak/colemak-less b/.zsh_plugins/colemak/colemak-less new file mode 100644 index 0000000..e4ca4fa --- /dev/null +++ b/.zsh_plugins/colemak/colemak-less @@ -0,0 +1,6 @@ +n forw-line +e back-line +k repeat-search +\ek repeat-search-all +K reverse-search +\eK reverse-search-all diff --git a/.zsh_plugins/colemak/colemak.plugin.zsh b/.zsh_plugins/colemak/colemak.plugin.zsh new file mode 100644 index 0000000..34d42c2 --- /dev/null +++ b/.zsh_plugins/colemak/colemak.plugin.zsh @@ -0,0 +1,22 @@ +# ctrl-j newline +bindkey '^n' accept-line +bindkey -a '^n' accept-line + +# another rotation to match qwerty +bindkey -a 'n' down-line-or-history +bindkey -a 'e' up-line-or-history +bindkey -a 'i' vi-forward-char + +# make qwerty +bindkey -a 'k' vi-repeat-search +bindkey -a 'K' vi-rev-repeat-search +bindkey -a 'u' vi-insert +bindkey -a 'U' vi-insert-bol +bindkey -a 'l' vi-undo-change +bindkey -a 'N' vi-join + +# spare +bindkey -a 'j' vi-forward-word-end +bindkey -a 'J' vi-forward-blank-word-end + +lesskey $ZSH_CUSTOM/plugins/colemak/colemak-less diff --git a/.zsh_plugins/colored-man/colored-man.plugin.zsh b/.zsh_plugins/colored-man/colored-man.plugin.zsh new file mode 100644 index 0000000..5605628 --- /dev/null +++ b/.zsh_plugins/colored-man/colored-man.plugin.zsh @@ -0,0 +1,11 @@ +man() { + env \ + LESS_TERMCAP_mb=$(printf "\e[1;31m") \ + LESS_TERMCAP_md=$(printf "\e[1;31m") \ + LESS_TERMCAP_me=$(printf "\e[0m") \ + LESS_TERMCAP_se=$(printf "\e[0m") \ + LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ + LESS_TERMCAP_ue=$(printf "\e[0m") \ + LESS_TERMCAP_us=$(printf "\e[1;32m") \ + man "$@" +} diff --git a/.zsh_plugins/colorize/colorize.plugin.zsh b/.zsh_plugins/colorize/colorize.plugin.zsh new file mode 100644 index 0000000..0696607 --- /dev/null +++ b/.zsh_plugins/colorize/colorize.plugin.zsh @@ -0,0 +1,28 @@ +# Plugin for highligthing file content +# Plugin highlights file content based on the filename extension. +# If no highlighting method supported for given extension then it tries +# guess it by looking for file content. + +alias colorize='colorize_via_pygmentize' + +colorize_via_pygmentize() { + if [ ! -x $(which pygmentize) ]; then + echo package \'pygmentize\' is not installed! + exit -1 + fi + + if [ $# -eq 0 ]; then + pygmentize -g $@ + fi + + for FNAME in $@ + do + filename=$(basename "$FNAME") + lexer=`pygmentize -N \"$filename\"` + if [ "Z$lexer" != "Ztext" ]; then + pygmentize -l $lexer "$FNAME" + else + pygmentize -g "$FNAME" + fi + done +} \ No newline at end of file diff --git a/.zsh_plugins/command-not-found/command-not-found.plugin.zsh b/.zsh_plugins/command-not-found/command-not-found.plugin.zsh new file mode 100644 index 0000000..f3d7ec2 --- /dev/null +++ b/.zsh_plugins/command-not-found/command-not-found.plugin.zsh @@ -0,0 +1,9 @@ +# Uses the command-not-found package zsh support +# as seen in http://www.porcheron.info/command-not-found-for-zsh/ +# this is installed in Ubuntu + +[[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found + +# Arch Linux command-not-found support, you must have package pkgfile installed +# https://wiki.archlinux.org/index.php/Pkgfile#.22Command_not_found.22_hook +[[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh diff --git a/.zsh_plugins/common-aliases/common-aliases.plugin.zsh b/.zsh_plugins/common-aliases/common-aliases.plugin.zsh new file mode 100644 index 0000000..879ffbf --- /dev/null +++ b/.zsh_plugins/common-aliases/common-aliases.plugin.zsh @@ -0,0 +1,95 @@ +# Advanced Aliases. +# Use with caution +# + +# ls, the common ones I use a lot shortened for rapid fire usage +#alias ls='ls --color' #I like color +alias ls="ls --color -F" +alias l='ls -lFh' #size,show type,human readable +alias la='ls -lAFh' #long list,show almost all,show type,human readable +alias lr='ls -tRFh' #sorted by date,recursive,show type,human readable +alias lt='ls -ltFh' #long list,sorted by date,show type,human readable +alias ll='ls -l' #long list +alias ldot='ls -ld .*' +alias lS='ls -1FSsh' +alias lart='ls -1Fcart' +alias lrt='ls -1Fcrt' + +alias zshrc='vim ~/.zshrc' # Quick access to the ~/.zshrc file + +alias grep='grep --color' +alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ' + +alias t='tail -f' + +# because typing 'cd' is A LOT of work!! +alias ..='cd ../' +alias ...='cd ../../' +alias ....='cd ../../../' +alias .....='cd ../../../../' + +# Command line head / tail shortcuts +alias -g H='| head' +alias -g T='| tail' +alias -g G='| grep' +alias -g L="| less" +alias -g M="| most" +alias -g LL="2>&1 | less" +alias -g CA="2>&1 | cat -A" +alias -g NE="2> /dev/null" +alias -g NUL="> /dev/null 2>&1" +alias -g P="2>&1| pygmentize -l pytb" + +alias dud='du --max-depth=1 -h' +alias duf='du -sh *' +alias fd='find . -type d -name' +alias ff='find . -type f -name' + +alias h='history' +alias hgrep="fc -El 0 | grep" +alias help='man' +alias j='jobs' +alias p='ps -f' +alias sortnr='sort -n -r' +alias unexport='unset' + +alias whereami=display_info + +alias rm='rm -i' +alias cp='cp -i' +alias mv='mv -i' + +# zsh is able to auto-do some kungfoo +# depends on the SUFFIX :) +if [ ${ZSH_VERSION//\./} -ge 420 ]; then + # open browser on urls + _browser_fts=(htm html de org net com at cx nl se dk dk php) + for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done + + _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex) + for ft in $_editor_fts ; do alias -s $ft=$EDITOR ; done + + _image_fts=(jpg jpeg png gif mng tiff tif xpm) + for ft in $_image_fts ; do alias -s $ft=$XIVIEWER; done + + _media_fts=(avi mpg mpeg ogm mp3 wav ogg ape rm mov mkv) + for ft in $_media_fts ; do alias -s $ft=mplayer ; done + + #read documents + alias -s pdf=acroread + alias -s ps=gv + alias -s dvi=xdvi + alias -s chm=xchm + alias -s djvu=djview + + #list whats inside packed file + alias -s zip="unzip -l" + alias -s rar="unrar l" + alias -s tar="tar tf" + alias -s tar.gz="echo " + alias -s ace="unace l" +fi + +# Make zsh know about hosts already accessed by SSH +zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })' + diff --git a/.zsh_plugins/compleat/compleat.plugin.zsh b/.zsh_plugins/compleat/compleat.plugin.zsh new file mode 100644 index 0000000..38f1b39 --- /dev/null +++ b/.zsh_plugins/compleat/compleat.plugin.zsh @@ -0,0 +1,20 @@ +# ------------------------------------------------------------------------------ +# FILE: compleat.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ + +if (( ${+commands[compleat]} )); then + local prefix="${commands[compleat]:h:h}" + local setup="${prefix}/share/compleat-1.0/compleat_setup" + + if [[ -f "$setup" ]]; then + if ! bashcompinit >/dev/null 2>&1; then + autoload -U bashcompinit + bashcompinit -i + fi + + source "$setup" + fi +fi diff --git a/.zsh_plugins/composer/composer.plugin.zsh b/.zsh_plugins/composer/composer.plugin.zsh new file mode 100644 index 0000000..9975aac --- /dev/null +++ b/.zsh_plugins/composer/composer.plugin.zsh @@ -0,0 +1,48 @@ +# ------------------------------------------------------------------------------ +# FILE: composer.plugin.zsh +# DESCRIPTION: oh-my-zsh composer plugin file. +# AUTHOR: Daniel Gomes (me@danielcsgomes.com) +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ + +# Composer basic command completion +_composer_get_command_list () { + composer --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }' +} + +_composer_get_required_list () { + composer show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }' +} + +_composer () { + local curcontext="$curcontext" state line + typeset -A opt_args + _arguments \ + '1: :->command'\ + '*: :->args' + if [ -f composer.json ]; then + case $state in + command) + compadd `_composer_get_command_list` + ;; + *) + compadd `_composer_get_required_list` + ;; + esac + else + compadd create-project init search selfupdate show + fi +} + +compdef _composer composer + +# Aliases +alias c='composer' +alias csu='composer self-update' +alias cu='composer update' +alias ci='composer install' +alias ccp='composer create-project' +alias cdu='composer dump-autoload' + +# install composer in the current directory +alias cget='curl -s https://getcomposer.org/installer | php' diff --git a/.zsh_plugins/copydir/copydir.plugin.zsh b/.zsh_plugins/copydir/copydir.plugin.zsh new file mode 100644 index 0000000..37bb5e0 --- /dev/null +++ b/.zsh_plugins/copydir/copydir.plugin.zsh @@ -0,0 +1,3 @@ +function copydir { + pwd | tr -d "\r\n" | pbcopy +} \ No newline at end of file diff --git a/.zsh_plugins/copyfile/copyfile.plugin.zsh b/.zsh_plugins/copyfile/copyfile.plugin.zsh new file mode 100644 index 0000000..944a903 --- /dev/null +++ b/.zsh_plugins/copyfile/copyfile.plugin.zsh @@ -0,0 +1,5 @@ +function copyfile { + [[ "$#" != 1 ]] && return 1 + local file_to_copy=$1 + cat $file_to_copy | pbcopy +} diff --git a/.zsh_plugins/cp/cp.plugin.zsh b/.zsh_plugins/cp/cp.plugin.zsh new file mode 100644 index 0000000..7355a99 --- /dev/null +++ b/.zsh_plugins/cp/cp.plugin.zsh @@ -0,0 +1,14 @@ +#Show progress while file is copying + +# Rsync options are: +# -p - preserve permissions +# -o - preserve owner +# -g - preserve group +# -h - output in human-readable format +# --progress - display progress +# -b - instead of just overwriting an existing file, save the original +# --backup-dir=/tmp/rsync - move backup copies to "/tmp/rsync" +# -e /dev/null - only work on local files +# -- - everything after this is an argument, even if it looks like an option + +alias cpv="rsync -poghb --backup-dir=/tmp/rsync -e /dev/null --progress --" diff --git a/.zsh_plugins/cpanm/_cpanm b/.zsh_plugins/cpanm/_cpanm new file mode 100644 index 0000000..58451d3 --- /dev/null +++ b/.zsh_plugins/cpanm/_cpanm @@ -0,0 +1,67 @@ +#compdef cpanm + +## +# cpanminus Z Shell completion script +## +# +# Current supported cpanm version: 1.4000 (Tue Mar 8 01:00:49 PST 2011) +# +# The latest code is always located at: +# https://github.com/rshhh/cpanminus/blob/master/etc/_cpanm +# + +local arguments curcontext="$curcontext" +typeset -A opt_args + + +arguments=( + +# Commands +# '(--install -i)'{--install,-i}'[Installs the modules]' + '(- :)--self-upgrade[Upgrades itself]' + '(- :)--info[Displays distribution info on CPAN]' + '(--installdeps)--installdeps[Only install dependencies]' + '(--look)--look[Download/unpack the distribution and then open the directory with your shell]' + '(- :)'{--help,-h}'[Displays help information]' + '(- :)'{--version,-V}'[Displays software version]' + +# Options + {--force,-f}'[Force install]' + {--notest,-n}'[Do not run unit tests]' + {--sudo,-S}'[sudo to run install commands]' + '(-v --verbose --quiet -q)'{--verbose,-v}'[Turns on chatty output]' + '(-q --quiet --verbose -v)'{--quiet,-q}'[Turns off all output]' + {--local-lib,-l}'[Specify the install base to install modules]' + {--local-lib-contained,-L}'[Specify the install base to install all non-core modules]' + '--mirror[Specify the base URL for the mirror (e.g. http://cpan.cpantesters.org/)]:URLs:_urls' + '--mirror-only[Use the mirror\''s index file instead of the CPAN Meta DB]' + '--prompt[Prompt when configure/build/test fails]' + '--reinstall[Reinstall the distribution even if you already have the latest version installed]' + '--interactive[Turn on interactive configure]' + + '--scandeps[Scan the depencencies of given modules and output the tree in a text format]' + '--format[Specify what format to display the scanned dependency tree]:scandeps format:(tree json yaml dists)' + + '--save-dists[Specify the optional directory path to copy downloaded tarballs]' +# '--uninst-shadows[Uninstalls the shadow files of the distribution that you\''re installing]' + + '--auto-cleanup[Number of days that cpanm\''s work directories expire in. Defaults to 7]' + '(--no-man-pages)--man-pages[Generates man pages for executables (man1) and libraries (man3)]' + '(--man-pages)--no-man-pages[Do not generate man pages]' + + + # Note: Normally with "--lwp", "--wget" and "--curl" options set to true (which is the default) cpanm tries LWP, + # Wget, cURL and HTTP::Tiny (in that order) and uses the first one available. + # (So that the exclusions are not enabled here for the completion) + '(--lwp)--lwp[Use LWP module to download stuff]' + '(--wget)--wget[Use GNU Wget (if available) to download stuff]' + '(--curl)--curl[Use cURL (if available) to download stuff]' + +# Other completions + '*:Local directory or archive:_files -/ -g "*.(tar.gz|tgz|tar.bz2|zip)(-.)"' + # '*::args: _normal' # this looks for default files (any files) +) +_arguments -s $arguments \ + && return 0 + +return 1 diff --git a/.zsh_plugins/debian/debian.plugin.zsh b/.zsh_plugins/debian/debian.plugin.zsh new file mode 100644 index 0000000..1e15487 --- /dev/null +++ b/.zsh_plugins/debian/debian.plugin.zsh @@ -0,0 +1,219 @@ +# Authors: +# https://github.com/AlexBio +# https://github.com/dbb +# https://github.com/Mappleconfusers +# +# Debian-related zsh aliases and functions for zsh + +# Use aptitude if installed, or apt-get if not. +# You can just set apt_pref='apt-get' to override it. +if [[ -e $( which -p aptitude 2>&1 ) ]]; then + apt_pref='aptitude' +else + apt_pref='apt-get' +fi + +# Use sudo by default if it's installed +if [[ -e $( which -p sudo 2>&1 ) ]]; then + use_sudo=1 +fi + +# Aliases ################################################################### +# These are for more obscure uses of apt-get and aptitude that aren't covered +# below. +alias ag='apt-get' +alias ap='aptitude' + +# Some self-explanatory aliases +alias acs="apt-cache search" +alias aps='aptitude search' +alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \ + --no-gui --disable-columns search" # search package + +# apt-file +alias afs='apt-file search --regexp' + + +# These are apt-get only +alias asrc='apt-get source' +alias app='apt-cache policy' + +# superuser operations ###################################################### +if [[ $use_sudo -eq 1 ]]; then +# commands using sudo ####### + alias aac='sudo $apt_pref autoclean' + alias abd='sudo $apt_pref build-dep' + alias ac='sudo $apt_pref clean' + alias ad='sudo $apt_pref update' + alias adg='sudo $apt_pref update && sudo $apt_pref upgrade' + alias adu='sudo $apt_pref update && sudo $apt_pref dist-upgrade' + alias afu='sudo apt-file update' + alias ag='sudo $apt_pref upgrade' + alias ai='sudo $apt_pref install' + # Install all packages given on the command line while using only the first word of each line: + # acs ... | ail + alias ail="sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | "' xargs sudo $apt_pref install' + alias ap='sudo $apt_pref purge' + alias ar='sudo $apt_pref remove' + + # apt-get only + alias ads='sudo apt-get dselect-upgrade' + + # Install all .deb files in the current directory. + # Warning: you will need to put the glob in single quotes if you use: + # glob_subst + alias dia='sudo dpkg -i ./*.deb' + alias di='sudo dpkg -i' + + # Remove ALL kernel images and headers EXCEPT the one in use + alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \ + ?not(~n`uname -r`))' + + +# commands using su ######### +else + alias aac='su -ls \'$apt_pref autoclean\' root' + abd() { + cmd="su -lc '$apt_pref build-dep $@' root" + print "$cmd" + eval "$cmd" + } + alias ac='su -ls \'$apt_pref clean\' root' + alias ad='su -lc \'$apt_pref update\' root' + alias adg='su -lc \'$apt_pref update && aptitude safe-upgrade\' root' + alias adu='su -lc \'$apt_pref update && aptitude dist-upgrade\' root' + alias afu='su -lc "apt-file update"' + alias ag='su -lc \'$apt_pref safe-upgrade\' root' + ai() { + cmd="su -lc 'aptitude -P install $@' root" + print "$cmd" + eval "$cmd" + } + ap() { + cmd="su -lc '$apt_pref -P purge $@' root" + print "$cmd" + eval "$cmd" + } + ar() { + cmd="su -lc '$apt_pref -P remove $@' root" + print "$cmd" + eval "$cmd" + } + + # Install all .deb files in the current directory + # Assumes glob_subst is off + alias dia='su -lc "dpkg -i ./*.deb" root' + alias di='su -lc "dpkg -i" root' + + # Remove ALL kernel images and headers EXCEPT the one in use + alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) \ + ?not(~n`uname -r`))'\'' root' +fi + +# Completion ################################################################ + +# +# Registers a compdef for $1 that calls $apt_pref with the commands $2 +# To do that it creates a new completion function called _apt_pref_$2 +# +apt_pref_compdef() { + local f fb + f="_apt_pref_${2}" + + eval "function ${f}() { + shift words; + service=\"\$apt_pref\"; + words=(\"\$apt_pref\" '$2' \$words); + ((CURRENT++)) + test \"\${apt_pref}\" = 'aptitude' && _aptitude || _apt + }" + + compdef "$f" "$1" +} + +apt_pref_compdef aac "autoclean" +apt_pref_compdef abd "build-dep" +apt_pref_compdef ac "clean" +apt_pref_compdef ad "update" +apt_pref_compdef afu "update" +apt_pref_compdef ag "upgrade" +apt_pref_compdef ai "install" +apt_pref_compdef ail "install" +apt_pref_compdef ap "purge" +apt_pref_compdef ar "remove" +apt_pref_compdef ads "dselect-upgrade" + +# Misc. ##################################################################### +# print all installed packages +alias allpkgs='aptitude search -F "%p" --disable-columns ~i' + +# Create a basic .deb package +alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' + + +# Functions ################################################################# +# create a simple script that can be used to 'duplicate' a system +apt-copy() { + print '#!/bin/sh'"\n" > apt-copy.sh + + cmd='$apt_pref install' + + for p in ${(f)"$(aptitude search -F "%p" --disable-columns \~i)"}; { + cmd="${cmd} ${p}" + } + + print $cmd "\n" >> apt-copy.sh + + chmod +x apt-copy.sh +} + +# Prints apt history +# Usage: +# apt-history install +# apt-history upgrade +# apt-history remove +# apt-history rollback +# apt-history list +# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html +apt-history () { + case "$1" in + install) + zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*) + ;; + upgrade|remove) + zgrep --no-filename $1 $(ls -rt /var/log/dpkg*) + ;; + rollback) + zgrep --no-filename upgrade $(ls -rt /var/log/dpkg*) | \ + grep "$2" -A10000000 | \ + grep "$3" -B10000000 | \ + awk '{print $4"="$5}' + ;; + list) + zcat $(ls -rt /var/log/dpkg*) + ;; + *) + echo "Parameters:" + echo " install - Lists all packages that have been installed." + echo " upgrade - Lists all packages that have been upgraded." + echo " remove - Lists all packages that have been removed." + echo " rollback - Lists rollback information." + echo " list - Lists all contains of dpkg logs." + ;; + esac +} + +# Kernel-package building shortcut +kerndeb () { + # temporarily unset MAKEFLAGS ( '-j3' will fail ) + MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' ) + print '$MAKEFLAGS set to '"'$MAKEFLAGS'" + appendage='-custom' # this shows up in $ (uname -r ) + revision=$(date +"%Y%m%d") # this shows up in the .deb file name + + make-kpkg clean + + time fakeroot make-kpkg --append-to-version "$appendage" --revision \ + "$revision" kernel_image kernel_headers +} + diff --git a/.zsh_plugins/dircycle/dircycle.plugin.zsh b/.zsh_plugins/dircycle/dircycle.plugin.zsh new file mode 100644 index 0000000..46a0ab2 --- /dev/null +++ b/.zsh_plugins/dircycle/dircycle.plugin.zsh @@ -0,0 +1,10 @@ +## +# dircycle plugin: enables cycling through the directory +# stack using Ctrl+Shift+Left/Right + +eval "insert-cycledleft () { zle push-line; LBUFFER='pushd -q +1'; zle accept-line }" +zle -N insert-cycledleft +bindkey "\e[1;6D" insert-cycledleft +eval "insert-cycledright () { zle push-line; LBUFFER='pushd -q -0'; zle accept-line }" +zle -N insert-cycledright +bindkey "\e[1;6C" insert-cycledright diff --git a/.zsh_plugins/dirpersist/dirpersist.plugin.zsh b/.zsh_plugins/dirpersist/dirpersist.plugin.zsh new file mode 100644 index 0000000..0f6d9f4 --- /dev/null +++ b/.zsh_plugins/dirpersist/dirpersist.plugin.zsh @@ -0,0 +1,39 @@ +#!/bin/zsh +# +# Make the dirstack more persistant +# +# Add dirpersist to $plugins in ~/.zshrc to load +# + +# $zdirstore is the file used to persist the stack +zdirstore=~/.zdirstore + +dirpersistinstall () { + if grep 'dirpersiststore' ~/.zlogout > /dev/null; then + else + if read -q \?"Would you like to set up your .zlogout file for use with dirspersist? (y/n) "; then + echo "# Store dirs stack\n# See $ZSH/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout + else + echo "If you don't want this message to appear, remove dirspersist from \$plugins" + fi + fi +} + +dirpersiststore () { + dirs -p | perl -e 'foreach (reverse ) {chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"}' > $zdirstore +} + +dirpersistrestore () { + if [ -f $zdirstore ]; then + source $zdirstore + fi +} + +DIRSTACKSIZE=10 +setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups + +dirpersistinstall +dirpersistrestore + +# Make popd changes permanent without having to wait for logout +alias popd="popd;dirpersiststore" diff --git a/.zsh_plugins/django/django.plugin.zsh b/.zsh_plugins/django/django.plugin.zsh new file mode 100644 index 0000000..9d898ed --- /dev/null +++ b/.zsh_plugins/django/django.plugin.zsh @@ -0,0 +1,238 @@ +#compdef manage.py + +typeset -ga nul_args +nul_args=( + '--settings=-[the Python path to a settings module.]:file:_files' + '--pythonpath=-[a directory to add to the Python path.]::directory:_directories' + '--traceback[print traceback on exception.]' + "--version[show program's version number and exit.]" + {-h,--help}'[show this help message and exit.]' +) + +_managepy-adminindex(){ + _arguments -s : \ + $nul_args \ + '*::directory:_directories' && ret=0 +} + +_managepy-createcachetable(){ + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-collectstatic(){ + _arguments -s : \ + '--link=-[Create a symbolic link to each file instead of copying.]:' \ + '--noinput=-[Do NOT prompt the user for input of any kind.]:' \ + '--no-post-process=-[Do NOT post process collected files.]:' \ + '--ignore=-[Ignore files or directories matching this glob-style pattern. Use multiple times to ignore more.]:' \ + '--dry-run=-[Do everything except modify the filesystem.]:' \ + '--clear=-[Clear the existing files using the storage before trying to copy or link the original file.]:' \ + '--link=-[Create a symbolic link to each file instead of copying.]:' \ + '--no-default-ignore=-[Do not ignore the common private glob-style patterns "CVS", ".*" and "*~".]:' \ + $nul_args && ret=0 +} + +_managepy-dbshell(){ + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-diffsettings(){ + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-dumpdata(){ + _arguments -s : \ + '--format=-[specifies the output serialization format for fixtures.]:format:(json yaml xml)' \ + '--indent=-[specifies the indent level to use when pretty-printing output.]:' \ + $nul_args \ + '*::appname:_applist' && ret=0 +} + +_managepy-flush(){ + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ + $nul_args && ret=0 +} + +_managepy-help(){ + _arguments -s : \ + '*:command:_managepy_cmds' \ + $nul_args && ret=0 +} + +_managepy_cmds(){ + local line + local -a cmd + _call_program help-command ./manage.py help \ + |& sed -n '/^ /s/[(), ]/ /gp' \ + | while read -A line; do cmd=($line $cmd) done + _describe -t managepy-command 'manage.py command' cmd +} + +_managepy-inspectdb(){ + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-loaddata(){ + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '*::file:_files' \ + $nul_args && ret=0 +} + +_managepy-reset(){ + _arguments -s : \ + '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ + '*::appname:_applist' \ + $nul_args && ret=0 +} + +_managepy-runfcgi(){ + local state + + local fcgi_opts + fcgi_opts=( + 'protocol[fcgi, scgi, ajp, ... (default fcgi)]:protocol:(fcgi scgi ajp)' + 'host[hostname to listen on..]:' + 'port[port to listen on.]:' + 'socket[UNIX socket to listen on.]::file:_files' + 'method[prefork or threaded (default prefork)]:method:(prefork threaded)' + 'maxrequests[number of requests a child handles before it is killed and a new child is forked (0 = no limit).]:' + 'maxspare[max number of spare processes / threads.]:' + 'minspare[min number of spare processes / threads.]:' + 'maxchildren[hard limit number of processes / threads.]:' + 'daemonize[whether to detach from terminal.]:boolean:(False True)' + 'pidfile[write the spawned process-id to this file.]:file:_files' + 'workdir[change to this directory when daemonizing.]:directory:_files' + 'outlog[write stdout to this file.]:file:_files' + 'errlog[write stderr to this file.]:file:_files' + ) + + _arguments -s : \ + $nul_args \ + '*: :_values "FCGI Setting" $fcgi_opts' && ret=0 +} + +_managepy-runserver(){ + _arguments -s : \ + '--noreload[tells Django to NOT use the auto-reloader.]' \ + '--adminmedia[specifies the directory from which to serve admin media.]:directory:_files' \ + $nul_args && ret=0 +} + +_managepy-shell(){ + _arguments -s : \ + '--plain[tells Django to use plain Python, not IPython.]' \ + $nul_args && ret=0 +} + +_managepy-sql(){} +_managepy-sqlall(){} +_managepy-sqlclear(){} +_managepy-sqlcustom(){} +_managepy-sqlflush(){} +_managepy-sqlindexes(){} +_managepy-sqlinitialdata(){} +_managepy-sqlreset(){} +_managepy-sqlsequencereset(){} +_managepy-startapp(){} + +_managepy-syncdb() { + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ + $nul_args && ret=0 +} + +_managepy-test() { + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ + '*::appname:_applist' \ + $nul_args && ret=0 +} + +_managepy-testserver() { + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '--addrport=-[port number or ipaddr:port to run the server on.]' \ + '*::fixture:_files' \ + $nul_args && ret=0 +} + +_managepy-validate() { + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-commands() { + local -a commands + + commands=( + 'adminindex:prints the admin-index template snippet for the given app name(s).' + 'createcachetable:creates the table needed to use the SQL cache backend.' + 'collectstatic:Collect static files in a single location.' + 'dbshell:runs the command-line client for the current DATABASE_ENGINE.' + "diffsettings:displays differences between the current settings.py and Django's default settings." + 'dumpdata:Output the contents of the database as a fixture of the given format.' + 'flush:Executes ``sqlflush`` on the current database.' + 'help:manage.py help.' + 'inspectdb:Introspects the database tables in the given database and outputs a Django model module.' + 'loaddata:Installs the named fixture(s) in the database.' + 'reset:Executes ``sqlreset`` for the given app(s) in the current database.' + 'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,' + 'runserver:Starts a lightweight Web server for development.' + 'shell:Runs a Python interactive interpreter.' + 'sql:Prints the CREATE TABLE SQL statements for the given app name(s).' + 'sqlall:Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).' + 'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).' + 'sqlcustom:Prints the custom table modifying SQL statements for the given app name(s).' + 'sqlflush:Returns a list of the SQL statements required to return all tables in the database to the state they were in just after they were installed.' + 'sqlindexes:Prints the CREATE INDEX SQL statements for the given model module name(s).' + "sqlinitialdata:RENAMED: see 'sqlcustom'" + 'sqlreset:Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).' + 'sqlsequencereset:Prints the SQL statements for resetting sequences for the given app name(s).' + "startapp:Creates a Django app directory structure for the given app name in this project's directory." + "syncdb:Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created." + 'test:Runs the test suite for the specified applications, or the entire site if no apps are specified.' + 'testserver:Runs a development server with data from the given fixture(s).' + 'validate:Validates all installed models.' + ) + + _describe -t commands 'manage.py command' commands && ret=0 +} + +_applist() { + local line + local -a apps + _call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\ + bn=op.basename(op.abspath(op.curdir));[sys\\ + .stdout.write(str(re.sub(r'^%s\.(.*?)$' % + bn, r'\1', i)) + '\n') for i in django.conf.settings.\\ + INSTALLED_APPS if re.match(r'^%s' % bn, i)]\"" \ + | while read -A line; do apps=($line $apps) done + _values 'Application' $apps && ret=0 +} + +_managepy() { + local curcontext=$curcontext ret=1 + + if ((CURRENT == 2)); then + _managepy-commands + else + shift words + (( CURRENT -- )) + curcontext="${curcontext%:*:*}:managepy-$words[1]:" + _call_function ret _managepy-$words[1] + fi +} + +compdef _managepy manage.py +compdef _managepy django +compdef _managepy django-admin.py +compdef _managepy django-manage diff --git a/.zsh_plugins/docker/README.md b/.zsh_plugins/docker/README.md new file mode 100644 index 0000000..231a6dc --- /dev/null +++ b/.zsh_plugins/docker/README.md @@ -0,0 +1,19 @@ +## Docker autocomplete plugin + +- Adds autocomplete options for all docker commands. +- Will also show containerIDs and Image names where applicable + +####Shows help for all commands +![General Help](http://i.imgur.com/tUBO9jh.png "Help for all commands") + + +####Shows your downloaded images where applicable +![Images](http://i.imgur.com/R8ZsWO1.png "Images") + + +####Shows your running containers where applicable +![Containers](http://i.imgur.com/WQtbheg.png "Containers") + + + +Maintainer : Ahmed Azaan ([@aeonazaan](https://twitter.com/aeonazaan)) diff --git a/.zsh_plugins/docker/_docker b/.zsh_plugins/docker/_docker new file mode 100644 index 0000000..f13f876 --- /dev/null +++ b/.zsh_plugins/docker/_docker @@ -0,0 +1,290 @@ +#compdef docker + +# Docker autocompletion for oh-my-zsh +# Requires: Docker installed +# Author : Azaan (@aeonazaan) + + +# ----- Helper functions +# Output a selectable list of all running docker containers +__docker_containers() { + declare -a cont_cmd + cont_cmd=($(docker ps | awk 'NR>1{print $1":[CON("$1")"$2"("$3")]"}')) + _describe 'containers' cont_cmd +} + +# output a selectable list of all docker images +__docker_images() { + declare -a img_cmd + img_cmd=($(docker images | awk 'NR>1{print $1}')) + _describe 'images' img_cmd +} + +# ----- Commands +# Seperate function for each command, makes extension easier later +# --------------------------- +__attach() { + __docker_containers +} + +__build() { + _arguments \ + '-q=false[Suppress verbose build output]' \ + '-t="[fuck to be applied to the resulting image in case of success]' \ + '*:files:_files' +} + +__commit() { + _arguments \ + '-author="[Author]' \ + '-m="[Commit message]' \ + '-run="[Config automatically applied when the image is run.\n]' + __docker_containers +} + +__diff() { + __docker_containers +} + +__export() { + __docker_containers +} + + +__history() { + __docker_images +} + +__images() { + _arguments \ + '-a[show all images]' \ + '-notrunc[dont truncate output]' \ + '-q[only show numeric IDs]' \ + '-viz[output graph in graphviz format]' + __docker_images +} + +__import() { + _arguments '*:files:_files' +} + +__info() { + # no arguments +} + +__insert() { + __docker_images + _arguments '*:files:_files' +} + +__inspect() { + __docker_images + __docker_containers +} + +__kill() { + __docker_containers +} + +__login() { + _arguments \ + '-e="[email]' \ + '-p="[password]' \ + '-u="[username]' \ +} + +__logs() { + __docker_containers +} + +__port() { + __docker_containers +} + +__top() { + __docker_containers +} + +__ps() { + _arguments \ + '-a[Show all containers. Only running containers are shown by default.]' \ + '-beforeId="[Show only container created before Id, include non-running ones.]' \ + '-l[Show only the latest created container, include non-running ones.]' \ + '-n=[Show n last created containers, include non-running ones.]' \ + '-notrurrrrnc[Dont truncate output]' \ + '-q[Only display numeric IDs]' \ + '-s[Display sizes]' \ + '-sinceId="[Show only containers created since Id, include non-running ones.]' +} + +__pull() { + _arguments '-t="[Download tagged image in repository]' +} + +__push() { + +} + +__restart() { + _arguments '-t=[number of seconds to try to stop before killing]' + __docker_containers +} + +__rm() { + _arguments '-v[Remove the volumes associated to the container]' + __docker_containers +} + +__rmi() { + __docker_images +} + +__run() { + _arguments \ + '-a=[Attach to stdin, stdout or stderr.]' \ + '-c=[CPU shares (relative weight)]' \ + '-d[Detached mode: leave the container running in the background]' \ + '-dns=[Set custom dns servers]' \ + '-e=[Set environment variables]' \ + '-entrypoint="[Overwrite the default entrypoint of the image]' \ + '-h="[Container host name]' \ + '-i[Keep stdin open even if not attached]' \ + '-m=[Memory limit (in bytes)]' \ + '-p=[Expose a containers port to the host (use docker port to see the actual mapping)]' \ + '-t[Allocate a pseudo-tty]' \ + '-u="[Username or UID]' \ + '-v=[Bind mount a volume (e.g. from the host: -v /host:/container, from docker: -v /container)]' \ + '-volumes-from="[Mount volumes from the specified container]' + __docker_images +} + +__search() { + _arguments '-notrunc[Dont truncate output]' +} + +__start() { + __docker_containers +} + +__stop() { + _arguments '-t=[number of seconds to try to stop before killing]' + __docker_containers +} + +__tag() { + _arguments '-f[Force]' + __docker_images +} + +__version() { + +} + +__wait() { + __docker_containers +} + +# end commands --------- +# ---------------------- + +local -a _1st_arguments +_1st_arguments=( + "attach":"Attach to a running container" + "build":"Build a container from a Dockerfile" + "commit":"Create a new image from a container's changes" + "diff":"Inspect changes on a container's filesystem" + "export":"Stream the contents of a container as a tar archive" + "history":"Show the history of an image" + "images":"List images" + "import":"Create a new filesystem image from the contents of a tarball" + "info":"Display system-wide information" + "insert":"Insert a file in an image" + "inspect":"Return low-level information on a container" + "kill":"Kill a running container" + "login":"Register or Login to the docker registry server" + "logs":"Fetch the logs of a container" + "port":"Lookup the public-facing port which is NAT-ed to PRIVATE_PORT" + "top":"Lookup the running processes of a container" + "ps":"List containers" + "pull":"Pull an image or a repository from the docker registry server" + "push":"Push an image or a repository to the docker registry server" + "restart":"Restart a running container" + "rm":"Remove one or more containers" + "rmi":"Remove one or more images" + "run":"Run a command in a new container" + "search":"Search for an image in the docker index" + "start":"Start a stopped container" + "stop":"Stop a running container" + "tag":"Tag an image into a repository" + "version":"Show the docker version information" + "wait":"Block until a container stops, then print its exit code" +) + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "docker command" _1st_arguments + return +fi + +local -a _command_args +case "$words[1]" in + attach) + __docker_containers ;; + build) + __build ;; + commit) + __commit ;; + diff) + __diff ;; + export) + __export ;; + history) + __history ;; + images) + __images ;; + import) + __import ;; + info) + __info ;; + insert) + __insert ;; + inspect) + __inspect ;; + kill) + __kill ;; + login) + __login ;; + logs) + __logs ;; + port) + __port ;; + top) + __top ;; + ps) + __ps ;; + pull) + __pull ;; + push) + __push ;; + restart) + __restart ;; + rm) + __rm ;; + rmi) + __rmi ;; + run) + __run ;; + search) + __search ;; + start) + __start ;; + stop) + __stop ;; + tag) + __tag ;; + version) + __version ;; + wait) + __wait ;; +esac diff --git a/.zsh_plugins/emoji-clock/emoji-clock.plugin.zsh b/.zsh_plugins/emoji-clock/emoji-clock.plugin.zsh new file mode 100644 index 0000000..7351a02 --- /dev/null +++ b/.zsh_plugins/emoji-clock/emoji-clock.plugin.zsh @@ -0,0 +1,29 @@ +# ------------------------------------------------------------------------------ +# FILE: emoji-clock.plugin.zsh +# DESCRIPTION: The current time with half hour accuracy as an emoji symbol. +# Inspired by Andre Torrez' "Put A Burger In Your Shell" +# http://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html +# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net) +# VERSION: 1.0.0 +# ----------------------------------------------------------------------------- + +function emoji-clock() { + hour=$(date '+%I') + minutes=$(date '+%M') + case $hour in + 01) clock="🕐"; [ $minutes -ge 30 ] && clock="🕜";; + 02) clock="🕑"; [ $minutes -ge 30 ] && clock="🕝";; + 03) clock="🕒"; [ $minutes -ge 30 ] && clock="🕞";; + 04) clock="🕓"; [ $minutes -ge 30 ] && clock="🕟";; + 05) clock="🕔"; [ $minutes -ge 30 ] && clock="🕠";; + 06) clock="🕕"; [ $minutes -ge 30 ] && clock="🕡";; + 07) clock="🕖"; [ $minutes -ge 30 ] && clock="🕢";; + 08) clock="🕗"; [ $minutes -ge 30 ] && clock="🕣";; + 09) clock="🕘"; [ $minutes -ge 30 ] && clock="🕤";; + 10) clock="🕙"; [ $minutes -ge 30 ] && clock="🕥";; + 11) clock="🕚"; [ $minutes -ge 30 ] && clock="🕦";; + 12) clock="🕛"; [ $minutes -ge 30 ] && clock="🕧";; + *) clock="⌛";; + esac + echo $clock +} diff --git a/.zsh_plugins/encode64/encode64.plugin.zsh b/.zsh_plugins/encode64/encode64.plugin.zsh new file mode 100644 index 0000000..4dbd1b4 --- /dev/null +++ b/.zsh_plugins/encode64/encode64.plugin.zsh @@ -0,0 +1,4 @@ +encode64(){ echo -n $1 | base64 } +decode64(){ echo -n $1 | base64 --decode } +alias e64=encode64 +alias d64=decode64 diff --git a/.zsh_plugins/extract/_extract b/.zsh_plugins/extract/_extract new file mode 100644 index 0000000..dca8909 --- /dev/null +++ b/.zsh_plugins/extract/_extract @@ -0,0 +1,8 @@ +#compdef extract +#autoload + +_arguments \ + '(-r --remove)'{-r,--remove}'[Remove archive.]' \ + "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0 + + diff --git a/.zsh_plugins/extract/extract.plugin.zsh b/.zsh_plugins/extract/extract.plugin.zsh new file mode 100644 index 0000000..7352e5b --- /dev/null +++ b/.zsh_plugins/extract/extract.plugin.zsh @@ -0,0 +1,80 @@ +# ------------------------------------------------------------------------------ +# FILE: extract.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) +# VERSION: 1.0.1 +# ------------------------------------------------------------------------------ + + +function extract() { + local remove_archive + local success + local file_name + local extract_dir + + if (( $# == 0 )); then + echo "Usage: extract [-option] [file ...]" + echo + echo Options: + echo " -r, --remove Remove archive." + echo + echo "Report bugs to ." + fi + + remove_archive=1 + if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then + remove_archive=0 + shift + fi + + while (( $# > 0 )); do + if [[ ! -f "$1" ]]; then + echo "extract: '$1' is not a valid file" 1>&2 + shift + continue + fi + + success=0 + file_name="$( basename "$1" )" + extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )" + case "$1" in + (*.tar.gz|*.tgz) tar xvzf "$1" ;; + (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; + (*.tar.xz|*.txz) tar --xz --help &> /dev/null \ + && tar --xz -xvf "$1" \ + || xzcat "$1" | tar xvf - ;; + (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \ + && tar --lzma -xvf "$1" \ + || lzcat "$1" | tar xvf - ;; + (*.tar) tar xvf "$1" ;; + (*.gz) gunzip "$1" ;; + (*.bz2) bunzip2 "$1" ;; + (*.xz) unxz "$1" ;; + (*.lzma) unlzma "$1" ;; + (*.Z) uncompress "$1" ;; + (*.zip|*.war|*.jar) unzip "$1" -d $extract_dir ;; + (*.rar) unrar x -ad "$1" ;; + (*.7z) 7za x "$1" ;; + (*.deb) + mkdir -p "$extract_dir/control" + mkdir -p "$extract_dir/data" + cd "$extract_dir"; ar vx "../${1}" > /dev/null + cd control; tar xzvf ../control.tar.gz + cd ../data; tar xzvf ../data.tar.gz + cd ..; rm *.tar.gz debian-binary + cd .. + ;; + (*) + echo "extract: '$1' cannot be extracted" 1>&2 + success=1 + ;; + esac + + (( success = $success > 0 ? $success : $? )) + (( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1" + shift + done +} + +alias x=extract + diff --git a/.zsh_plugins/fabric/_fab b/.zsh_plugins/fabric/_fab new file mode 100644 index 0000000..9628e12 --- /dev/null +++ b/.zsh_plugins/fabric/_fab @@ -0,0 +1,60 @@ +#compdef fab +#autoload + +local curcontext=$curcontext state line +declare -A opt_args + +declare target_list +target_list=(`fab --shortlist 2>/dev/null`) + +_targets() { + _describe -t commands "fabric targets" target_list +} + +output_levels=( + 'status: Status messages, i.e. noting when Fabric is done running, if the user used a keyboard interrupt, or when servers are disconnected from. These messages are almost always relevant and rarely verbose.' + 'aborts: Abort messages. Like status messages, these should really only be turned off when using Fabric as a library, and possibly not even then. Note that even if this output group is turned off, aborts will still occur – there just won’t be any output about why Fabric aborted!' + 'warnings: Warning messages. These are often turned off when one expects a given operation to fail, such as when using grep to test existence of text in a file. If paired with setting env.warn_only to True, this can result in fully silent warnings when remote programs fail. As with aborts, this setting does not control actual warning behavior, only whether warning messages are printed or hidden.' + 'running: Printouts of commands being executed or files transferred, e.g. [myserver] run: ls /var/www. Also controls printing of tasks being run, e.g. [myserver] Executing task ''foo''.' + 'stdout: Local, or remote, stdout, i.e. non-error output from commands.' + 'stderr: Local, or remote, stderr, i.e. error-related output from commands.' + 'user: User-generated output, i.e. local output printed by fabfile code via use of the fastprint or puts functions.' +) + +_arguments -w -S -C \ + '(-)'{-h,--help}'[show this help message and exit]: :->noargs' \ + '(-)'{-V,--version}'[show program''s version number and exit]: :->noargs' \ + '(-)--list[print list of possible commands and exit]: :->noargs' \ + '(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \ + '(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \ + '(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \ + "(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_targets" \ + '(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \ + '(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \ + '(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \ + '(-p+ --password=-)'{-p+,--password=-}'[password for use with authentication and/or sudo]: :' \ + '(-H+ --hosts=-)'{-H+,--hosts=-}'[comma separated list of hosts to operate on]: :' \ + '(-R+ --roles=-)'{-R+,--roles=-}'[comma separated list of roles to operate on]: :' \ + '(-a --no-agent)'{-a,--no-agent}'[don''t use the running SSH agent]' \ + '(-k --no-keys)'{-k,--no-keys}'[don''t load private key files from ~/.ssh/]' \ + '(-w --warn-only)'{-w,--warn-only}'[warn instead of abort, when commands fail]' \ + '-i+[path to SSH private key file. May be repeated]: :_files' \ + "(-f+ --fabfile=)"{-f+,--fabfile=}"[Python module file to import]: :_files -g *.py" \ + '(-c+ --config=-)'{-c+,--config=-}'[specify location of config file to use]: :_files' \ + '(-s+ --shell=-)'{-s+,--shell=-}'[specify a new shell, defaults to ''/bin/bash -l -c'']: :' \ + '(--hide=-)--hide=-[comma-separated list of output levels to hide]: :->levels' \ + '(--show=-)--show=-[comma-separated list of output levels to show]: :->levels' \ + '*::: :->subcmds' && return 0 + +if [[ CURRENT -ge 1 ]]; then + case $state in + noargs) + _message "nothing to complete";; + levels) + _describe -t commands "output levels" output_levels;; + *) + _targets;; + esac + + return +fi diff --git a/.zsh_plugins/fabric/fabric.plugin.zsh b/.zsh_plugins/fabric/fabric.plugin.zsh new file mode 100644 index 0000000..aca4113 --- /dev/null +++ b/.zsh_plugins/fabric/fabric.plugin.zsh @@ -0,0 +1 @@ +# DECLARION: This plugin was created by vhbit. What I did is just making a portal from https://github.com/vhbit/fabric-zsh-autocomplete. diff --git a/.zsh_plugins/fasd/fasd.plugin.zsh b/.zsh_plugins/fasd/fasd.plugin.zsh new file mode 100644 index 0000000..8ad43fc --- /dev/null +++ b/.zsh_plugins/fasd/fasd.plugin.zsh @@ -0,0 +1,11 @@ +if [ $commands[fasd] ]; then # check if fasd is installed + fasd_cache="$HOME/.fasd-init-cache" + if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then + fasd --init auto >| "$fasd_cache" + fi + source "$fasd_cache" + unset fasd_cache + alias v='f -e vim' + alias o='a -e open' +fi + diff --git a/.zsh_plugins/fastfile/fastfile.plugin.zsh b/.zsh_plugins/fastfile/fastfile.plugin.zsh new file mode 100644 index 0000000..775e948 --- /dev/null +++ b/.zsh_plugins/fastfile/fastfile.plugin.zsh @@ -0,0 +1,138 @@ +################################################################################ +# FILE: fastfile.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Michael Varner (musikmichael@web.de) +# VERSION: 1.0.0 +# +# This plugin adds the ability to on the fly generate and access file shortcuts. +# +################################################################################ + +########################### +# Settings + +# These can be overwritten any time. +# If they are not set yet, they will be +# overwritten with their default values + +default fastfile_dir "${HOME}/.fastfile/" +default fastfile_var_prefix "§" + +########################### +# Impl + +# +# Generate a shortcut +# +# Arguments: +# 1. name - The name of the shortcut (default: name of the file) +# 2. file - The file or directory to make the shortcut for +# STDOUT: +# => fastfle_print +# +function fastfile() { + test "$2" || 2="." + file=$(readlink -f "$2") + + test "$1" || 1="$(basename "$file")" + name=$(echo "$1" | tr " " "_") + + + mkdir -p "${fastfile_dir}" + echo "$file" > "$(fastfile_resolv "$name")" + + fastfile_sync + fastfile_print "$name" +} + +# +# Resolve the location of a shortcut file (the database file, where the value is written!) +# +# Arguments: +# 1. name - The name of the shortcut +# STDOUT: +# The path +# +function fastfile_resolv() { + echo "${fastfile_dir}${1}" +} + +# +# Get the real path of a shortcut +# +# Arguments: +# 1. name - The name of the shortcut +# STDOUT: +# The path +# +function fastfile_get() { + cat "$(fastfile_resolv "$1")" +} + +# +# Print a shortcut +# +# Arguments: +# 1. name - The name of the shortcut +# STDOUT: +# Name and value of the shortcut +# +function fastfile_print() { + echo "${fastfile_var_prefix}${1} -> $(fastfile_get "$1")" +} + +# +# List all shortcuts +# +# STDOUT: +# (=> fastfle_print) for each shortcut +# +function fastfile_ls() { + for f in "${fastfile_dir}"/*; do + file=`basename "$f"` # To enable simpler handeling of spaces in file names + varkey=`echo "$file" | tr " " "_"` + + # Special format for colums + echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")" + done | column -t -s "|" +} + +# +# Remove a shortcut +# +# Arguments: +# 1. name - The name of the shortcut (default: name of the file) +# 2. file - The file or directory to make the shortcut for +# STDOUT: +# => fastfle_print +# +function fastfile_rm() { + fastfile_print "$1" + rm "$(fastfile_resolv "$1")" +} + +# +# Generate the aliases for the shortcuts +# +function fastfile_sync() { + for f in "${fastfile_dir}"/*; do + file=`basename "$f"` # To enable simpler handeling of spaces in file names + varkey=`echo "$file" | tr " " "_"` + + alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'" + done +} + +################################## +# Shortcuts + +alias ff=fastfile +alias ffp=fastfile_print +alias ffrm=fastfile_rm +alias ffls=fastfile_ls +alias ffsync=fastfile_sync + +################################## +# Init + +fastfile_sync \ No newline at end of file diff --git a/.zsh_plugins/fbterm/fbterm.plugin.zsh b/.zsh_plugins/fbterm/fbterm.plugin.zsh new file mode 100644 index 0000000..4f04560 --- /dev/null +++ b/.zsh_plugins/fbterm/fbterm.plugin.zsh @@ -0,0 +1,6 @@ +# start fbterm automatically in /dev/tty* + +if [[ $(tty|grep -o '/dev/tty') = /dev/tty ]] ; then + fbterm + exit +fi diff --git a/.zsh_plugins/forklift/forklift.plugin.zsh b/.zsh_plugins/forklift/forklift.plugin.zsh new file mode 100644 index 0000000..b0e60a4 --- /dev/null +++ b/.zsh_plugins/forklift/forklift.plugin.zsh @@ -0,0 +1,69 @@ +# Open folder in ForkLift.app of ForkLift2.app from console +# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de +# Updated to support ForkLift2 by Johan Kaving +# +# Usage: +# fl [] +# +# Opens specified directory or current working directory in ForkLift.app +# +# Notes: +# It assumes Shift+Cmd+G launches go to folder panel and Cmd+N opens new +# app window. +# +# https://gist.github.com/3313481 +function fl { + if [ ! -z "$1" ]; then + DIR=$1 + if [ ! -d "$DIR" ]; then + DIR=$(dirname $DIR) + fi + if [ "$DIR" != "." ]; then + PWD=`cd "$DIR";pwd` + fi + fi + osascript 2>&1 1>/dev/null <cmds' \ + '*: :->args' && ret=0 + +case $state in + cmds) + cmds=( + "version:Prints Gas's version" + "use:Uses author" + "show:Shows your current user" + "list:Lists your authors" + "import:Imports current user to gasconfig" + "help:Describe available tasks or one specific task" + "delete:Deletes author" + "add:Adds author to gasconfig" + ) + _describe -t commands 'gas command' cmds && ret=0 + ;; + args) + case $line[1] in + (use|delete) + _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 + ;; + esac + ;; +esac + +return ret diff --git a/.zsh_plugins/gem/_gem b/.zsh_plugins/gem/_gem new file mode 100644 index 0000000..66c77b7 --- /dev/null +++ b/.zsh_plugins/gem/_gem @@ -0,0 +1,67 @@ +#compdef gem +#autoload + +# gem zsh completion, based on homebrew completion + +_gem_installed() { + installed_gems=(${(f)"$(gem list --local --no-versions)"}) +} + +local -a _1st_arguments + +_1st_arguments=( + 'build:Build a gem from a gemspec' + 'cert:Manage RubyGems certificates and signing settings' + 'check:Check a gem repository for added or missing files' + 'cleanup:Clean up old versions of installed gems in the local repository' + 'contents:Display the contents of the installed gems' + 'dependency:Show the dependencies of an installed gem' + 'environment:Display information about the RubyGems environment' + 'fetch:Download a gem and place it in the current directory' + 'generate_index:Generates the index files for a gem server directory' + 'help:Provide help on the `gem` command' + 'install:Install a gem into the local repository' + 'list:Display gems whose name starts with STRING' + 'lock:Generate a lockdown list of gems' + 'mirror:Mirror all gem files (requires rubygems-mirror)' + 'outdated:Display all gems that need updates' + 'owner:Manage gem owners on RubyGems.org.' + 'pristine:Restores installed gems to pristine condition from files located in the gem cache' + 'push:Push a gem up to RubyGems.org' + 'query:Query gem information in local or remote repositories' + 'rdoc:Generates RDoc for pre-installed gems' + 'search:Display all gems whose name contains STRING' + 'server:Documentation and gem repository HTTP server' + 'sources:Manage the sources and cache file RubyGems uses to search for gems' + 'specification:Display gem specification (in yaml)' + 'stale:List gems along with access times' + 'uninstall:Uninstall gems from the local repository' + 'unpack:Unpack an installed gem to the current directory' + 'update:Update installed gems to the latest version' + 'which:Find the location of a library file you can require' + 'yank:Remove a specific gem version release from RubyGems.org' +) + +local expl +local -a gems installed_gems + +_arguments \ + '(-v --version)'{-v,--version}'[show version]' \ + '(-h --help)'{-h,--help}'[show help]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "gem subcommand" _1st_arguments + return +fi + +case "$words[1]" in + list) + if [[ "$state" == forms ]]; then + _gem_installed + _requested installed_gems expl 'installed gems' compadd -a installed_gems + fi ;; + uninstall|update) + _gem_installed + _wanted installed_gems expl 'installed gems' compadd -a installed_gems ;; +esac diff --git a/.zsh_plugins/gem/gem.plugin.zsh b/.zsh_plugins/gem/gem.plugin.zsh new file mode 100644 index 0000000..938f5c9 --- /dev/null +++ b/.zsh_plugins/gem/gem.plugin.zsh @@ -0,0 +1,7 @@ +alias gemb="gem build *.gemspec" +alias gemp="gem push *.gem" + +# gemy GEM 0.0.0 = gem yank GEM -v 0.0.0 +function gemy { + gem yank $1 -v $2 +} \ No newline at end of file diff --git a/.zsh_plugins/git-extras/git-extras.plugin.zsh b/.zsh_plugins/git-extras/git-extras.plugin.zsh new file mode 100644 index 0000000..8419166 --- /dev/null +++ b/.zsh_plugins/git-extras/git-extras.plugin.zsh @@ -0,0 +1,285 @@ +#compdef git +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for git-extras (http://github.com/visionmedia/git-extras). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Alexis GRIMALDI (https://github.com/agrimaldi) +# +# ------------------------------------------------------------------------------ +# Inspirations +# ----------- +# +# * git-extras (http://github.com/visionmedia/git-extras) +# * git-flow-completion (http://github.com/bobthecow/git-flow-completion) +# +# ------------------------------------------------------------------------------ + + +__git_command_successful () { + if (( ${#pipestatus:#0} > 0 )); then + _message 'not a git repository' + return 1 + fi + return 0 +} + + +__git_tag_names() { + local expl + declare -a tag_names + tag_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/}) + __git_command_successful || return + _wanted tag-names expl tag-name compadd $* - $tag_names +} + + +__git_branch_names() { + local expl + declare -a branch_names + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) + __git_command_successful || return + _wanted branch-names expl branch-name compadd $* - $branch_names +} + + +__git_feature_branch_names() { + local expl + declare -a branch_names + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/feature 2>/dev/null)"}#refs/heads/feature/}) + __git_command_successful || return + _wanted branch-names expl branch-name compadd $* - $branch_names +} + + +__git_refactor_branch_names() { + local expl + declare -a branch_names + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/refactor 2>/dev/null)"}#refs/heads/refactor/}) + __git_command_successful || return + _wanted branch-names expl branch-name compadd $* - $branch_names +} + + +__git_bug_branch_names() { + local expl + declare -a branch_names + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/bug 2>/dev/null)"}#refs/heads/bug/}) + __git_command_successful || return + _wanted branch-names expl branch-name compadd $* - $branch_names +} + + +__git_submodule_names() { + local expl + declare -a submodule_names + submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"}) + __git_command_successful || return + _wanted submodule-names expl submodule-name compadd $* - $submodule_names +} + + +__git_author_names() { + local expl + declare -a author_names + author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"}) + __git_command_successful || return + _wanted author-names expl author-name compadd $* - $author_names +} + + +_git-changelog() { + _arguments \ + '(-l --list)'{-l,--list}'[list commits]' \ +} + + +_git-effort() { + _arguments \ + '--above[ignore file with less than x commits]' \ +} + + +_git-contrib() { + _arguments \ + ':author:__git_author_names' +} + + +_git-count() { + _arguments \ + '--all[detailed commit count]' +} + + +_git-delete-branch() { + _arguments \ + ':branch-name:__git_branch_names' +} + + +_git-delete-submodule() { + _arguments \ + ':submodule-name:__git_submodule_names' +} + + +_git-delete-tag() { + _arguments \ + ':tag-name:__git_tag_names' +} + + +_git-extras() { + local curcontext=$curcontext state line ret=1 + declare -A opt_args + + _arguments -C \ + ': :->command' \ + '*:: :->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + commands=( + 'update:update git-extras' + ) + _describe -t commands command commands && ret=0 + ;; + esac + + _arguments \ + '(-v --version)'{-v,--version}'[show current version]' \ +} + + +_git-graft() { + _arguments \ + ':src-branch-name:__git_branch_names' \ + ':dest-branch-name:__git_branch_names' +} + + +_git-squash() { + _arguments \ + ':branch-name:__git_branch_names' +} + + +_git-feature() { + local curcontext=$curcontext state line ret=1 + declare -A opt_args + + _arguments -C \ + ': :->command' \ + '*:: :->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + commands=( + 'finish:merge feature into the current branch' + ) + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (finish) + _arguments -C \ + ':branch-name:__git_feature_branch_names' + ;; + esac + esac +} + + +_git-refactor() { + local curcontext=$curcontext state line ret=1 + declare -A opt_args + + _arguments -C \ + ': :->command' \ + '*:: :->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + commands=( + 'finish:merge refactor into the current branch' + ) + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (finish) + _arguments -C \ + ':branch-name:__git_refactor_branch_names' + ;; + esac + esac +} + + +_git-bug() { + local curcontext=$curcontext state line ret=1 + declare -A opt_args + + _arguments -C \ + ': :->command' \ + '*:: :->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + commands=( + 'finish:merge bug into the current branch' + ) + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (finish) + _arguments -C \ + ':branch-name:__git_bug_branch_names' + ;; + esac + esac +} + + +zstyle ':completion:*:*:git:*' user-commands \ + changelog:'populate changelog file with commits since the previous tag' \ + contrib:'display author contributions' \ + count:'count commits' \ + delete-branch:'delete local and remote branch' \ + delete-submodule:'delete submodule' \ + delete-tag:'delete local and remote tag' \ + extras:'git-extras' \ + graft:'merge commits from source branch to destination branch' \ + squash:'merge commits from source branch into the current one as a single commit' \ + feature:'create a feature branch' \ + refactor:'create a refactor branch' \ + bug:'create a bug branch' \ + summary:'repository summary' \ + effort:'display effort statistics' \ + repl:'read-eval-print-loop' \ + commits-since:'list commits since a given date' \ + release:'release commit with the given tag' \ + alias:'define, search and show aliases' \ + ignore:'add patterns to .gitignore' \ + info:'show info about the repository' \ + create-branch:'create local and remote branch' \ + fresh-branch:'create empty local branch' \ + undo:'remove the latest commit' \ + setup:'setup a git repository' \ + touch:'one step creation of new files' \ + obliterate:'Completely remove a file from the repository, including past commits and tags' \ + local-commits:'list unpushed commits on the local branch' \ diff --git a/.zsh_plugins/git-flow-avh/git-flow-avh.plugin.zsh b/.zsh_plugins/git-flow-avh/git-flow-avh.plugin.zsh new file mode 100644 index 0000000..ba98fff --- /dev/null +++ b/.zsh_plugins/git-flow-avh/git-flow-avh.plugin.zsh @@ -0,0 +1,419 @@ +#!zsh +# +# Installation +# ------------ +# +# To achieve git-flow completion nirvana: +# +# 0. Update your zsh's git-completion module to the newest verion. +# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD +# +# 1. Install this file. Either: +# +# a. Place it in your .zshrc: +# +# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.zsh) and put the following line in +# your .zshrc: +# +# source ~/.git-flow-completion.zsh +# +# c. Or, use this file as a oh-my-zsh plugin. +# + +_git-flow () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'init:Initialize a new git repo with support for the branching model.' + 'feature:Manage your feature branches.' + 'config:Manage your configuration.' + 'release:Manage your release branches.' + 'hotfix:Manage your hotfix branches.' + 'support:Manage your support branches.' + 'version:Shows version information.' + 'finish:Finish the branch you are currently on.' + 'delete:Delete the branch you are currently on.' + 'publish:Publish the branch you are currently on.' + ) + _describe -t commands 'git flow' subcommands + ;; + + (options) + case $line[1] in + + (init) + _arguments \ + -f'[Force setting of gitflow branches, even if already configured]' + ;; + + (version) + ;; + + (hotfix) + __git-flow-hotfix + ;; + + (release) + __git-flow-release + ;; + + (feature) + __git-flow-feature + ;; + (config) + __git-flow-config + ;; + + esac + ;; + esac +} + +__git-flow-release () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new release branch.' + 'finish:Finish a release branch.' + 'list:List all your release branches. (Alias to `git flow release`)' + 'publish:Publish release branch to remote.' + 'track:Checkout remote release branch.' + 'delete:Delete a release branch.' + ) + _describe -t commands 'git flow release' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':version:__git_flow_version_list' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + ':version:__git_flow_version_list' + ;; + + (delete) + _arguments \ + -f'[Force deletion]' \ + -r'[Delete remote branch]' \ + ':version:__git_flow_version_list' + ;; + + (publish) + _arguments \ + ':version:__git_flow_version_list' + ;; + + (track) + _arguments \ + ':version:__git_flow_version_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-hotfix () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new hotfix branch.' + 'finish:Finish a hotfix branch.' + 'delete:Delete a hotfix branch.' + 'list:List all your hotfix branches. (Alias to `git flow hotfix`)' + ) + _describe -t commands 'git flow hotfix' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':hotfix:__git_flow_version_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + ':hotfix:__git_flow_hotfix_list' + ;; + + (delete) + _arguments \ + -f'[Force deletion]' \ + -r'[Delete remote branch]' \ + ':hotfix:__git_flow_hotfix_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-feature () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new feature branch.' + 'finish:Finish a feature branch.' + 'delete:Delete a feature branch.' + 'list:List all your feature branches. (Alias to `git flow feature`)' + 'publish:Publish feature branch to remote.' + 'track:Checkout remote feature branch.' + 'diff:Show all changes.' + 'rebase:Rebase from integration branch.' + 'checkout:Checkout local feature branch.' + 'pull:Pull changes from remote.' + ) + _describe -t commands 'git flow feature' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':feature:__git_flow_feature_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -r'[Rebase instead of merge]'\ + ':feature:__git_flow_feature_list' + ;; + + (delete) + _arguments \ + -f'[Force deletion]' \ + -r'[Delete remote branch]' \ + ':feature:__git_flow_feature_list' + ;; + + (publish) + _arguments \ + ':feature:__git_flow_feature_list'\ + ;; + + (track) + _arguments \ + ':feature:__git_flow_feature_list'\ + ;; + + (diff) + _arguments \ + ':branch:__git_branch_names'\ + ;; + + (rebase) + _arguments \ + -i'[Do an interactive rebase]' \ + ':branch:__git_branch_names' + ;; + + (checkout) + _arguments \ + ':branch:__git_flow_feature_list'\ + ;; + + (pull) + _arguments \ + ':remote:__git_remotes'\ + ':branch:__git_branch_names' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-config () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'list:List the configuration. (Alias to `git flow config`)' + 'set:Set the configuration option' + ) + _describe -t commands 'git flow config' subcommands + ;; + + (options) + case $line[1] in + + (set) + _arguments \ + --local'[Use repository config file]' \ + --global'[Use global config file]'\ + --system'[Use system config file]'\ + --file'[Use given config file]'\ + ':option:(master develop feature hotfix release support versiontagprefix)' + ;; + + *) + _arguments \ + --local'[Use repository config file]' \ + --global'[Use global config file]'\ + --system'[Use system config file]'\ + --file'[Use given config file]' + ;; + esac + ;; + esac +} +__git_flow_version_list () +{ + local expl + declare -a versions + + versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted versions expl 'version' compadd $versions +} + +__git_flow_feature_list () +{ + local expl + declare -a features + + features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted features expl 'feature' compadd $features +} + +__git_remotes () { + local expl gitdir remotes + + gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) + __git_command_successful || return + + remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) + __git_command_successful || return + + # TODO: Should combine the two instead of either or. + if (( $#remotes > 0 )); then + _wanted remotes expl remote compadd $* - $remotes + else + _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" + fi +} + +__git_flow_hotfix_list () +{ + local expl + declare -a hotfixes + + hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted hotfixes expl 'hotfix' compadd $hotfixes +} + +__git_branch_names () { + local expl + declare -a branch_names + + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) + __git_command_successful || return + + _wanted branch-names expl branch-name compadd $* - $branch_names +} + +__git_command_successful () { + if (( ${#pipestatus:#0} > 0 )); then + _message 'not a git repository' + return 1 + fi + return 0 +} + +zstyle ':completion:*:*:git:*' user-commands flow:'provide high-level repository operations' diff --git a/.zsh_plugins/git-flow/git-flow.plugin.zsh b/.zsh_plugins/git-flow/git-flow.plugin.zsh new file mode 100644 index 0000000..b9ea068 --- /dev/null +++ b/.zsh_plugins/git-flow/git-flow.plugin.zsh @@ -0,0 +1,355 @@ +#!zsh +# +# Installation +# ------------ +# +# To achieve git-flow completion nirvana: +# +# 0. Update your zsh's git-completion module to the newest verion. +# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD +# +# 1. Install this file. Either: +# +# a. Place it in your .zshrc: +# +# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.zsh) and put the following line in +# your .zshrc: +# +# source ~/.git-flow-completion.zsh +# +# c. Or, use this file as a oh-my-zsh plugin. +# + +#Alias +alias gf='git flow' +alias gcd='git checkout develop' +alias gch='git checkout hotfix' +alias gcr='git checkout release' + +_git-flow () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'init:Initialize a new git repo with support for the branching model.' + 'feature:Manage your feature branches.' + 'release:Manage your release branches.' + 'hotfix:Manage your hotfix branches.' + 'support:Manage your support branches.' + 'version:Shows version information.' + ) + _describe -t commands 'git flow' subcommands + ;; + + (options) + case $line[1] in + + (init) + _arguments \ + -f'[Force setting of gitflow branches, even if already configured]' + ;; + + (version) + ;; + + (hotfix) + __git-flow-hotfix + ;; + + (release) + __git-flow-release + ;; + + (feature) + __git-flow-feature + ;; + esac + ;; + esac +} + +__git-flow-release () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new release branch.' + 'finish:Finish a release branch.' + 'list:List all your release branches. (Alias to `git flow release`)' + 'publish: public' + 'track: track' + ) + _describe -t commands 'git flow release' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':version:__git_flow_version_list' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + -k'[Keep branch after performing finish]'\ + -n"[Don't tag this release]"\ + ':version:__git_flow_version_list' + ;; + + (publish) + _arguments \ + ':version:__git_flow_version_list'\ + ;; + + (track) + _arguments \ + ':version:__git_flow_version_list'\ + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-hotfix () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new hotfix branch.' + 'finish:Finish a hotfix branch.' + 'list:List all your hotfix branches. (Alias to `git flow hotfix`)' + ) + _describe -t commands 'git flow hotfix' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':hotfix:__git_flow_version_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + -k'[Keep branch after performing finish]'\ + -n"[Don't tag this release]"\ + ':hotfix:__git_flow_hotfix_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-feature () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new feature branch.' + 'finish:Finish a feature branch.' + 'list:List all your feature branches. (Alias to `git flow feature`)' + 'publish: publish' + 'track: track' + 'diff: diff' + 'rebase: rebase' + 'checkout: checkout' + 'pull: pull' + ) + _describe -t commands 'git flow feature' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':feature:__git_flow_feature_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -r'[Rebase instead of merge]'\ + -k'[Keep branch after performing finish]'\ + ':feature:__git_flow_feature_list' + ;; + + (publish) + _arguments \ + ':feature:__git_flow_feature_list'\ + ;; + + (track) + _arguments \ + ':feature:__git_flow_feature_list'\ + ;; + + (diff) + _arguments \ + ':branch:__git_flow_feature_list'\ + ;; + + (rebase) + _arguments \ + -i'[Do an interactive rebase]' \ + ':branch:__git_flow_feature_list' + ;; + + (checkout) + _arguments \ + ':branch:__git_flow_feature_list'\ + ;; + + (pull) + _arguments \ + ':remote:__git_remotes'\ + ':branch:__git_flow_feature_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git_flow_version_list () +{ + local expl + declare -a versions + + versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted versions expl 'version' compadd $versions +} + +__git_flow_feature_list () +{ + local expl + declare -a features + + features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted features expl 'feature' compadd $features +} + +__git_remotes () { + local expl gitdir remotes + + gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) + __git_command_successful || return + + remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) + __git_command_successful || return + + # TODO: Should combine the two instead of either or. + if (( $#remotes > 0 )); then + _wanted remotes expl remote compadd $* - $remotes + else + _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" + fi +} + +__git_flow_hotfix_list () +{ + local expl + declare -a hotfixes + + hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted hotfixes expl 'hotfix' compadd $hotfixes +} + +__git_branch_names () { + local expl + declare -a branch_names + + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) + __git_command_successful || return + + _wanted branch-names expl branch-name compadd $* - $branch_names +} + +__git_command_successful () { + if (( ${#pipestatus:#0} > 0 )); then + _message 'not a git repository' + return 1 + fi + return 0 +} + +zstyle ':completion:*:*:git:*' user-commands flow:'description for foo' diff --git a/.zsh_plugins/git-hubflow/git-hubflow.plugin.zsh b/.zsh_plugins/git-hubflow/git-hubflow.plugin.zsh new file mode 100644 index 0000000..a09f883 --- /dev/null +++ b/.zsh_plugins/git-hubflow/git-hubflow.plugin.zsh @@ -0,0 +1,348 @@ +#!zsh +# +# Installation +# ------------ +# +# To achieve git-hubflow completion nirvana: +# +# 0. Update your zsh's git-completion module to the newest verion. +# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD +# +# 1. Install this file. Either: +# +# a. Place it in your .zshrc: +# +# b. Or, copy it somewhere (e.g. ~/.git-hubflow-completion.zsh) and put the following line in +# your .zshrc: +# +# source ~/.git-hubflow-completion.zsh +# +# c. Or, use this file as a oh-my-zsh plugin. +# + +_git-hf () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'init:Initialize a new git repo with support for the branching model.' + 'feature:Manage your feature branches.' + 'release:Manage your release branches.' + 'hotfix:Manage your hotfix branches.' + 'support:Manage your support branches.' + 'update:Pull upstream changes down into your master and develop branches.' + 'version:Shows version information.' + ) + _describe -t commands 'git hf' subcommands + ;; + + (options) + case $line[1] in + + (init) + _arguments \ + -f'[Force setting of gitflow branches, even if already configured]' + ;; + + (version) + ;; + + (hotfix) + __git-hf-hotfix + ;; + + (release) + __git-hf-release + ;; + + (feature) + __git-hf-feature + ;; + esac + ;; + esac +} + +__git-hf-release () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new release branch.' + 'finish:Finish a release branch.' + 'list:List all your release branches. (Alias to `git hf release`)' + 'cancel:Cancel release' + 'push:Push release to github' + 'pull:Pull release from github' + 'track:Track release' + ) + _describe -t commands 'git hf release' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':version:__git_hf_version_list' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + -k'[Keep branch after performing finish]'\ + -n"[Don't tag this release]"\ + ':version:__git_hf_version_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-hf-hotfix () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new hotfix branch.' + 'finish:Finish a hotfix branch.' + 'list:List all your hotfix branches. (Alias to `git hf hotfix`)' + 'publish:Publish the hotfix branch.' + 'track:Track the hotfix branch.' + 'pull:Pull the hotfix from github.' + 'push:Push the hotfix to github.' + 'cancel:Cancel the hotfix.' + ) + _describe -t commands 'git hf hotfix' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':hotfix:__git_hf_version_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + -k'[Keep branch after performing finish]'\ + -n"[Don't tag this release]"\ + ':hotfix:__git_hf_hotfix_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-hf-feature () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'list:List all your feature branches. (Alias to `git hf feature`)' + 'start:Start a new feature branch' + 'finish:Finish a feature branch' + 'submit:submit' + 'track:track' + 'diff:Diff' + 'rebase:Rebase feature branch against develop' + 'checkout:Checkout feature' + 'pull:Pull feature branch from github' + 'push:Push feature branch to github' + 'cancel:Cancel feature' + ) + _describe -t commands 'git hf feature' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':feature:__git_hf_feature_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -r'[Rebase instead of merge]'\ + ':feature:__git_hf_feature_list' + ;; + + (publish) + _arguments \ + ':feature:__git_hf_feature_list'\ + ;; + + (track) + _arguments \ + ':feature:__git_hf_feature_list'\ + ;; + + (diff) + _arguments \ + ':branch:__git_branch_names'\ + ;; + + (rebase) + _arguments \ + -i'[Do an interactive rebase]' \ + ':branch:__git_branch_names' + ;; + + (checkout) + _arguments \ + ':branch:__git_hf_feature_list'\ + ;; + + (pull) + _arguments \ + ':remote:__git_remotes'\ + ':branch:__git_branch_names' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git_hf_version_list () +{ + local expl + declare -a versions + + versions=(${${(f)"$(_call_program versions git hf release list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted versions expl 'version' compadd $versions +} + +__git_hf_feature_list () +{ + local expl + declare -a features + + features=(${${(f)"$(_call_program features git hf feature list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted features expl 'feature' compadd $features +} + +__git_remotes () { + local expl gitdir remotes + + gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) + __git_command_successful || return + + remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) + __git_command_successful || return + + # TODO: Should combine the two instead of either or. + if (( $#remotes > 0 )); then + _wanted remotes expl remote compadd $* - $remotes + else + _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" + fi +} + +__git_hf_hotfix_list () +{ + local expl + declare -a hotfixes + + hotfixes=(${${(f)"$(_call_program hotfixes git hf hotfix list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted hotfixes expl 'hotfix' compadd $hotfixes +} + +__git_branch_names () { + local expl + declare -a branch_names + + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) + __git_command_successful || return + + _wanted branch-names expl branch-name compadd $* - $branch_names +} + +__git_command_successful () { + if (( ${#pipestatus:#0} > 0 )); then + _message 'not a git repository' + return 1 + fi + return 0 +} + +zstyle ':completion:*:*:git:*' user-commands flow:'description for foo' diff --git a/.zsh_plugins/git-prompt/git-prompt.plugin.zsh b/.zsh_plugins/git-prompt/git-prompt.plugin.zsh new file mode 100644 index 0000000..01b8a88 --- /dev/null +++ b/.zsh_plugins/git-prompt/git-prompt.plugin.zsh @@ -0,0 +1,60 @@ +# ZSH Git Prompt Plugin from: +# http://github.com/olivierverdier/zsh-git-prompt +# +export __GIT_PROMPT_DIR=$ZSH/plugins/git-prompt +# Initialize colors. +autoload -U colors +colors + +# Allow for functions in the prompt. +setopt PROMPT_SUBST + +## Enable auto-execution of functions. +typeset -ga preexec_functions +typeset -ga precmd_functions +typeset -ga chpwd_functions + +# Append git functions needed for prompt. +preexec_functions+='preexec_update_git_vars' +precmd_functions+='precmd_update_git_vars' +chpwd_functions+='chpwd_update_git_vars' + +## Function definitions +function preexec_update_git_vars() { + case "$2" in + git*) + __EXECUTED_GIT_COMMAND=1 + ;; + esac +} + +function precmd_update_git_vars() { + if [ -n "$__EXECUTED_GIT_COMMAND" ]; then + update_current_git_vars + unset __EXECUTED_GIT_COMMAND + fi +} + +function chpwd_update_git_vars() { + update_current_git_vars +} + +function update_current_git_vars() { + unset __CURRENT_GIT_STATUS + + local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py" + _GIT_STATUS=`python ${gitstatus}` + __CURRENT_GIT_STATUS=("${(f)_GIT_STATUS}") +} + +function prompt_git_info() { + if [ -n "$__CURRENT_GIT_STATUS" ]; then + echo "(%{${fg[red]}%}$__CURRENT_GIT_STATUS[1]%{${fg[default]}%}$__CURRENT_GIT_STATUS[2]%{${fg[magenta]}%}$__CURRENT_GIT_STATUS[3]%{${fg[default]}%})" + fi +} + +# Set the prompt. +#PROMPT='%B%m%~%b$(prompt_git_info) %# ' +# for a right prompt: +#RPROMPT='%b$(prompt_git_info)' +RPROMPT='$(prompt_git_info)' diff --git a/.zsh_plugins/git-prompt/gitstatus.py b/.zsh_plugins/git-prompt/gitstatus.py new file mode 100644 index 0000000..ef894bf --- /dev/null +++ b/.zsh_plugins/git-prompt/gitstatus.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- +from subprocess import Popen, PIPE +import re + +# change those symbols to whatever you prefer +symbols = { + 'ahead of': '↑', + 'behind': '↓', + 'staged': '♦', + 'changed': '‣', + 'untracked': '…', + 'clean': '⚡', + 'unmerged': '≠', + 'sha1': ':' +} + +output, error = Popen( + ['git', 'status'], stdout=PIPE, stderr=PIPE).communicate() + +if error: + import sys + sys.exit(0) +lines = output.splitlines() + +behead_re = re.compile( + r"^# Your branch is (ahead of|behind) '(.*)' by (\d+) commit") +diverge_re = re.compile(r"^# and have (\d+) and (\d+) different") + +status = '' +staged = re.compile(r'^# Changes to be committed:$', re.MULTILINE) +changed = re.compile(r'^# Changed but not updated:$', re.MULTILINE) +untracked = re.compile(r'^# Untracked files:$', re.MULTILINE) +unmerged = re.compile(r'^# Unmerged paths:$', re.MULTILINE) + + +def execute(*command): + out, err = Popen(stdout=PIPE, stderr=PIPE, *command).communicate() + if not err: + nb = len(out.splitlines()) + else: + nb = '?' + return nb + +if staged.search(output): + nb = execute( + ['git', 'diff', '--staged', '--name-only', '--diff-filter=ACDMRT']) + status += '%s%s' % (symbols['staged'], nb) +if unmerged.search(output): + nb = execute(['git', 'diff', '--staged', '--name-only', '--diff-filter=U']) + status += '%s%s' % (symbols['unmerged'], nb) +if changed.search(output): + nb = execute(['git', 'diff', '--name-only', '--diff-filter=ACDMRT']) + status += '%s%s' % (symbols['changed'], nb) +if untracked.search(output): + status += symbols['untracked'] +if status == '': + status = symbols['clean'] + +remote = '' + +bline = lines[0] +if bline.find('Not currently on any branch') != -1: + branch = symbols['sha1'] + Popen([ + 'git', + 'rev-parse', + '--short', + 'HEAD'], stdout=PIPE).communicate()[0][:-1] +else: + branch = bline.split(' ')[-1] + bstatusline = lines[1] + match = behead_re.match(bstatusline) + if match: + remote = symbols[match.groups()[0]] + remote += match.groups()[2] + elif lines[2:]: + div_match = diverge_re.match(lines[2]) + if div_match: + remote = "{behind}{1}{ahead of}{0}".format( + *div_match.groups(), **symbols) + +print('\n'.join([branch, remote, status])) diff --git a/.zsh_plugins/git-remote-branch/git-remote-branch.plugin.zsh b/.zsh_plugins/git-remote-branch/git-remote-branch.plugin.zsh new file mode 100644 index 0000000..6c5ab8f --- /dev/null +++ b/.zsh_plugins/git-remote-branch/git-remote-branch.plugin.zsh @@ -0,0 +1,19 @@ +_git_remote_branch() { + ref=$(git symbolic-ref HEAD 2> /dev/null) + if [[ -n $ref ]]; then + if (( CURRENT == 2 )); then + # first arg: operation + compadd create publish rename delete track + elif (( CURRENT == 3 )); then + # second arg: remote branch name + remotes=`git remote | tr '\n' '|' | sed "s/\|$//g"` + compadd `git branch -r | grep -v HEAD | sed "s/$remotes\///" | sed "s/ //g"` + elif (( CURRENT == 4 )); then + # third arg: remote name + compadd `git remote` + fi + else; + _files + fi +} +compdef _git_remote_branch grb diff --git a/.zsh_plugins/git/README.md b/.zsh_plugins/git/README.md new file mode 100644 index 0000000..8462dda --- /dev/null +++ b/.zsh_plugins/git/README.md @@ -0,0 +1,4 @@ +## git +**Maintainer:** [Stibbons](https://github.com/Stibbons) + +This plugin adds several git aliases and increase the completion function provided by zsh diff --git a/.zsh_plugins/git/_git-branch b/.zsh_plugins/git/_git-branch new file mode 100644 index 0000000..6b9c1a4 --- /dev/null +++ b/.zsh_plugins/git/_git-branch @@ -0,0 +1,83 @@ +#compdef git-branch + +_git-branch () +{ + declare l c m d + + l='--color --no-color -r -a --all -v --verbose --abbrev --no-abbrev' + c='-l -f --force -t --track --no-track --set-upstream --contains --merged --no-merged' + m='-m -M' + d='-d -D' + + declare -a dependent_creation_args + if (( words[(I)-r] == 0 )); then + dependent_creation_args=( + "($l $m $d): :__git_branch_names" + "::start-point:__git_revisions") + fi + + declare -a dependent_deletion_args + if (( words[(I)-d] || words[(I)-D] )); then + dependent_creation_args= + dependent_deletion_args=( + '-r[delete only remote-tracking branches]') + if (( words[(I)-r] )); then + dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_remote_branch_names' + else + dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_branch_names' + fi + fi + + declare -a dependent_modification_args + if (( words[(I)-m] || words[(I)-M] )); then + dependent_creation_args= + dependent_modification_args=( + ':old or new branch name:__git_branch_names' + '::new branch name:__git_branch_names') + fi + + _arguments -w -S -s \ + "($c $m $d --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \ + "($c $m $d : --color)--no-color[turn off branch coloring]" \ + "($c $m -a --all)-r[list or delete only remote-tracking branches]" \ + "($c $m $d : -r)"{-a,--all}"[list both remote-tracking branches and local branches]" \ + "($c $m $d : -v --verbose)"{-v,--verbose}'[show SHA1 and commit subject line for each head]' \ + "($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \ + "($c $m $d :)--no-abbrev[do not abbreviate sha1s]" \ + "($l $m $d)-l[create the branch's reflog]" \ + "($l $m $d -f --force)"{-f,--force}"[force the creation of a new branch]" \ + "($l $m $d -t --track)"{-t,--track}"[set up configuration so that pull merges from the start point]" \ + "($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \ + "($l $m $d)--set-upstream[set up configuration so that pull merges]" \ + "($l $m $d)--contains=[only list branches which contain the specified commit]: :__git_committishs" \ + "($l $m $d)--merged=[only list branches which are fully contained by HEAD]: :__git_committishs" \ + "($l $m $d)--no-merged=[do not list branches which are fully contained by HEAD]: :__git_committishs" \ + $dependent_creation_args \ + "($l $c $d -M)-m[rename a branch and the corresponding reflog]" \ + "($l $c $d -m)-M[rename a branch even if the new branch-name already exists]" \ + $dependent_modification_args \ + "($l $c $m -D)-d[delete a fully merged branch]" \ + "($l $c $m -d)-D[delete a branch]" \ + $dependent_deletion_args +} + +(( $+functions[__git_ignore_line] )) || +__git_ignore_line () { + declare -a ignored + ignored=() + ((CURRENT > 1)) && + ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) + ((CURRENT < $#line)) && + ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) + $* -F ignored +} + +(( $+functions[__git_ignore_line_inside_arguments] )) || +__git_ignore_line_inside_arguments () { + declare -a compadd_opts + + zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F: + + __git_ignore_line $* $compadd_opts +} + diff --git a/.zsh_plugins/git/_git-remote b/.zsh_plugins/git/_git-remote new file mode 100644 index 0000000..4ba62a3 --- /dev/null +++ b/.zsh_plugins/git/_git-remote @@ -0,0 +1,74 @@ +#compdef git-remote + +# NOTE: --track is undocumented. +# TODO: --track, -t, --master, and -m should take remote branches, I guess. +# NOTE: --master is undocumented. +# NOTE: --fetch is undocumented. +_git-remote () { + local curcontext=$curcontext state line + declare -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' && ret=0 + + case $state in + (command) + declare -a commands + + commands=( + 'add:add a new remote' + 'show:show information about a given remote' + 'prune:delete all stale tracking branches for a given remote' + 'update:fetch updates for a set of remotes' + 'rm:remove a remote from .git/config and all associated tracking branches' + 'rename:rename a remote from .git/config and update all associated tracking branches' + 'set-head:sets or deletes the default branch' + 'set-branches:changes the list of branches tracked by the named remote.' + 'set-url:changes URL remote points to.' + ) + + _describe -t commands 'sub-command' commands && ret=0 + ;; + (options) + case $line[1] in + (add) + _arguments \ + '*'{--track,-t}'[track given branch instead of default glob refspec]:branch:__git_branch_names' \ + '(--master -m)'{--master,-m}'[set the remote'\''s HEAD to point to given master branch]:branch:__git_branch_names' \ + '(--fetch -f)'{--fetch,-f}'[run git-fetch on the new remote after it has been created]' \ + ':branch name:__git_remotes' \ + ':url:_urls' && ret=0 + ;; + (show) + _arguments \ + '-n[do not contact the remote for a list of branches]' \ + ':remote:__git_remotes' && ret=0 + ;; + (prune) + _arguments \ + '(--dry-run -n)'{-n,--dry-run}'[do not actually prune, only list what would be done]' \ + ':remote:__git_remotes' && ret=0 + ;; + (update) + __git_remote-groups && ret=0 + ;; + (rm) + __git_remotes && ret=0 + ;; + (rename) + __git_remotes && ret=0 + ;; + (set-url) + _arguments \ + '*--push[manipulate push URLs]' \ + '(--add)--add[add URL]' \ + '(--delete)--delete[delete URLs]' \ + ':branch name:__git_remotes' \ + ':url:_urls' && ret=0 + ;; + + esac + ;; + esac +} diff --git a/.zsh_plugins/git/git.plugin.zsh b/.zsh_plugins/git/git.plugin.zsh new file mode 100644 index 0000000..2b5983f --- /dev/null +++ b/.zsh_plugins/git/git.plugin.zsh @@ -0,0 +1,162 @@ +# Aliases +alias g='git' +compdef g=git +alias gst='git status' +compdef _git gst=git-status +alias gd='git diff' +compdef _git gd=git-diff +alias gdc='git diff --cached' +compdef _git gdc=git-diff +alias gl='git pull' +compdef _git gl=git-pull +alias gup='git pull --rebase' +compdef _git gup=git-fetch +alias gp='git push' +compdef _git gp=git-push +alias gd='git diff' +gdv() { git diff -w "$@" | view - } +compdef _git gdv=git-diff +alias gc='git commit -v' +compdef _git gc=git-commit +alias gc!='git commit -v --amend' +compdef _git gc!=git-commit +alias gca='git commit -v -a' +compdef _git gc=git-commit +alias gca!='git commit -v -a --amend' +compdef _git gca!=git-commit +alias gcmsg='git commit -m' +compdef _git gcmsg=git-commit +alias gco='git checkout' +compdef _git gco=git-checkout +alias gcm='git checkout master' +alias gr='git remote' +compdef _git gr=git-remote +alias grv='git remote -v' +compdef _git grv=git-remote +alias grmv='git remote rename' +compdef _git grmv=git-remote +alias grrm='git remote remove' +compdef _git grrm=git-remote +alias grset='git remote set-url' +compdef _git grset=git-remote +alias grup='git remote update' +compdef _git grset=git-remote +alias grbi='git rebase -i' +compdef _git grbi=git-rebase +alias grbc='git rebase --continue' +compdef _git grbc=git-rebase +alias grba='git rebase --abort' +compdef _git grba=git-rebase +alias gb='git branch' +compdef _git gb=git-branch +alias gba='git branch -a' +compdef _git gba=git-branch +alias gcount='git shortlog -sn' +compdef gcount=git +alias gcl='git config --list' +alias gcp='git cherry-pick' +compdef _git gcp=git-cherry-pick +alias glg='git log --stat --max-count=10' +compdef _git glg=git-log +alias glgg='git log --graph --max-count=10' +compdef _git glgg=git-log +alias glgga='git log --graph --decorate --all' +compdef _git glgga=git-log +alias glo='git log --oneline --decorate --color' +compdef _git glo=git-log +alias glog='git log --oneline --decorate --color --graph' +compdef _git glog=git-log +alias gss='git status -s' +compdef _git gss=git-status +alias ga='git add' +compdef _git ga=git-add +alias gm='git merge' +compdef _git gm=git-merge +alias grh='git reset HEAD' +alias grhh='git reset HEAD --hard' +alias gclean='git reset --hard && git clean -dfx' +alias gwc='git whatchanged -p --abbrev-commit --pretty=medium' + +#remove the gf alias +#alias gf='git ls-files | grep' + +alias gpoat='git push origin --all && git push origin --tags' +alias gmt='git mergetool --no-prompt' +compdef _git gm=git-mergetool + +alias gg='git gui citool' +alias gga='git gui citool --amend' +alias gk='gitk --all --branches' + +alias gsts='git stash show --text' +alias gsta='git stash' +alias gstp='git stash pop' +alias gstd='git stash drop' + +# Will cd into the top of the current repository +# or submodule. +alias grt='cd $(git rev-parse --show-toplevel || echo ".")' + +# Git and svn mix +alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' +compdef git-svn-dcommit-push=git + +alias gsr='git svn rebase' +alias gsd='git svn dcommit' +# +# Will return the current branch name +# Usage example: git pull origin $(current_branch) +# +function current_branch() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || \ + ref=$(git rev-parse --short HEAD 2> /dev/null) || return + echo ${ref#refs/heads/} +} + +function current_repository() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || \ + ref=$(git rev-parse --short HEAD 2> /dev/null) || return + echo $(git remote -v | cut -d':' -f 2) +} + +# these aliases take advantage of the previous function +alias ggpull='git pull origin $(current_branch)' +compdef ggpull=git +alias ggpur='git pull --rebase origin $(current_branch)' +compdef ggpur=git +alias ggpush='git push origin $(current_branch)' +compdef ggpush=git +alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' +compdef ggpnp=git + +# Pretty log messages +function _git_log_prettily(){ + if ! [ -z $1 ]; then + git log --pretty=$1 + fi +} +alias glp="_git_log_prettily" +compdef _git glp=git-log + +# Work In Progress (wip) +# These features allow to pause a branch development and switch to another one (wip) +# When you want to go back to work, just unwip it +# +# This function return a warning if the current branch is a wip +function work_in_progress() { + if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then + echo "WIP!!" + fi +} +# these alias commit and uncomit wip branches +alias gwip='git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m "--wip--"' +alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' + +# these alias ignore changes to file +alias gignore='git update-index --assume-unchanged' +alias gunignore='git update-index --no-assume-unchanged' +# list temporarily ignored files +alias gignored='git ls-files -v | grep "^[[:lower:]]"' + + + diff --git a/.zsh_plugins/gitfast/_git b/.zsh_plugins/gitfast/_git new file mode 100644 index 0000000..fac5e71 --- /dev/null +++ b/.zsh_plugins/gitfast/_git @@ -0,0 +1,216 @@ +#compdef git gitk + +# zsh completion wrapper for git +# +# Copyright (c) 2012-2013 Felipe Contreras +# +# You need git's bash completion script installed somewhere, by default it +# would be the location bash-completion uses. +# +# If your script is somewhere else, you can configure it on your ~/.zshrc: +# +# zstyle ':completion:*:*:git:*' script ~/.git-completion.sh +# +# The recommended way to install this script is to copy to '~/.zsh/_git', and +# then add the following to your ~/.zshrc file: +# +# fpath=(~/.zsh $fpath) + +complete () +{ + # do nothing + return 0 +} + +zstyle -T ':completion:*:*:git:*' tag-order && \ + zstyle ':completion:*:*:git:*' tag-order 'common-commands' + +zstyle -s ":completion:*:*:git:*" script script +if [ -z "$script" ]; then + local -a locations + local e + locations=( + '/etc/bash_completion.d/git' # fedora, old debian + '/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian + '/usr/share/bash-completion/git' # gentoo + $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash + ) + for e in $locations; do + test -f $e && script="$e" && break + done +fi +ZSH_VERSION='' . "$script" + +__gitcomp () +{ + emulate -L zsh + + local cur_="${3-$cur}" + + case "$cur_" in + --*=) + ;; + *) + local c IFS=$' \t\n' + local -a array + for c in ${=1}; do + c="$c${4-}" + case $c in + --*=*|*.) ;; + *) c="$c " ;; + esac + array+=("$c") + done + compset -P '*[=:]' + compadd -Q -S '' -p "${2-}" -a -- array && _ret=0 + ;; + esac +} + +__gitcomp_nl () +{ + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0 +} + +__gitcomp_file () +{ + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -p "${2-}" -f -- ${=1} && _ret=0 +} + +__git_zsh_bash_func () +{ + emulate -L ksh + + local command=$1 + + local completion_func="_git_${command//-/_}" + declare -f $completion_func >/dev/null && $completion_func && return + + local expansion=$(__git_aliased_command "$command") + if [ -n "$expansion" ]; then + completion_func="_git_${expansion//-/_}" + declare -f $completion_func >/dev/null && $completion_func + fi +} + +__git_zsh_cmd_common () +{ + local -a list + list=( + add:'add file contents to the index' + bisect:'find by binary search the change that introduced a bug' + branch:'list, create, or delete branches' + checkout:'checkout a branch or paths to the working tree' + clone:'clone a repository into a new directory' + commit:'record changes to the repository' + diff:'show changes between commits, commit and working tree, etc' + fetch:'download objects and refs from another repository' + grep:'print lines matching a pattern' + init:'create an empty Git repository or reinitialize an existing one' + log:'show commit logs' + merge:'join two or more development histories together' + mv:'move or rename a file, a directory, or a symlink' + pull:'fetch from and merge with another repository or a local branch' + push:'update remote refs along with associated objects' + rebase:'forward-port local commits to the updated upstream head' + reset:'reset current HEAD to the specified state' + rm:'remove files from the working tree and from the index' + show:'show various types of objects' + status:'show the working tree status' + tag:'create, list, delete or verify a tag object signed with GPG') + _describe -t common-commands 'common commands' list && _ret=0 +} + +__git_zsh_cmd_alias () +{ + local -a list + list=(${${${(0)"$(git config -z --get-regexp '^alias\.')"}#alias.}%$'\n'*}) + _describe -t alias-commands 'aliases' list $* && _ret=0 +} + +__git_zsh_cmd_all () +{ + local -a list + emulate ksh -c __git_compute_all_commands + list=( ${=__git_all_commands} ) + _describe -t all-commands 'all commands' list && _ret=0 +} + +__git_zsh_main () +{ + local curcontext="$curcontext" state state_descr line + typeset -A opt_args + local -a orig_words + + orig_words=( ${words[@]} ) + + _arguments -C \ + '(-p --paginate --no-pager)'{-p,--paginate}'[pipe all output into ''less'']' \ + '(-p --paginate)--no-pager[do not pipe git output into a pager]' \ + '--git-dir=-[set the path to the repository]: :_directories' \ + '--bare[treat the repository as a bare repository]' \ + '(- :)--version[prints the git suite version]' \ + '--exec-path=-[path to where your core git programs are installed]:: :_directories' \ + '--html-path[print the path where git''s HTML documentation is installed]' \ + '--info-path[print the path where the Info files are installed]' \ + '--man-path[print the manpath (see `man(1)`) for the man pages]' \ + '--work-tree=-[set the path to the working tree]: :_directories' \ + '--namespace=-[set the git namespace]' \ + '--no-replace-objects[do not use replacement refs to replace git objects]' \ + '(- :)--help[prints the synopsis and a list of the most commonly used commands]: :->arg' \ + '(-): :->command' \ + '(-)*:: :->arg' && return + + case $state in + (command) + _alternative \ + 'alias-commands:alias:__git_zsh_cmd_alias' \ + 'common-commands:common:__git_zsh_cmd_common' \ + 'all-commands:all:__git_zsh_cmd_all' && _ret=0 + ;; + (arg) + local command="${words[1]}" __git_dir + + if (( $+opt_args[--bare] )); then + __git_dir='.' + else + __git_dir=${opt_args[--git-dir]} + fi + + (( $+opt_args[--help] )) && command='help' + + words=( ${orig_words[@]} ) + + __git_zsh_bash_func $command + ;; + esac +} + +_git () +{ + local _ret=1 + local cur cword prev + + cur=${words[CURRENT]} + prev=${words[CURRENT-1]} + let cword=CURRENT-1 + + if (( $+functions[__${service}_zsh_main] )); then + __${service}_zsh_main + else + emulate ksh -c __${service}_main + fi + + let _ret && _default && _ret=0 + return _ret +} + +_git diff --git a/.zsh_plugins/gitfast/git-completion.bash b/.zsh_plugins/gitfast/git-completion.bash new file mode 100644 index 0000000..5da920e --- /dev/null +++ b/.zsh_plugins/gitfast/git-completion.bash @@ -0,0 +1,2663 @@ +#!bash +# +# bash/zsh completion support for core Git. +# +# Copyright (C) 2006,2007 Shawn O. Pearce +# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). +# Distributed under the GNU General Public License, version 2.0. +# +# The contained completion routines provide support for completing: +# +# *) local and remote branch names +# *) local and remote tag names +# *) .git/remotes file names +# *) git 'subcommands' +# *) tree paths within 'ref:path/to/file' expressions +# *) file paths within current working directory and index +# *) common --long-options +# +# To use these routines: +# +# 1) Copy this file to somewhere (e.g. ~/.git-completion.sh). +# 2) Add the following line to your .bashrc/.zshrc: +# source ~/.git-completion.sh +# 3) Consider changing your PS1 to also show the current branch, +# see git-prompt.sh for details. + +case "$COMP_WORDBREAKS" in +*:*) : great ;; +*) COMP_WORDBREAKS="$COMP_WORDBREAKS:" +esac + +# __gitdir accepts 0 or 1 arguments (i.e., location) +# returns location of .git repo +__gitdir () +{ + if [ -z "${1-}" ]; then + if [ -n "${__git_dir-}" ]; then + echo "$__git_dir" + elif [ -n "${GIT_DIR-}" ]; then + test -d "${GIT_DIR-}" || return 1 + echo "$GIT_DIR" + elif [ -d .git ]; then + echo .git + else + git rev-parse --git-dir 2>/dev/null + fi + elif [ -d "$1/.git" ]; then + echo "$1/.git" + else + echo "$1" + fi +} + +# The following function is based on code from: +# +# bash_completion - programmable completion functions for bash 3.2+ +# +# Copyright © 2006-2008, Ian Macdonald +# © 2009-2010, Bash Completion Maintainers +# +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# The latest version of this software can be obtained here: +# +# http://bash-completion.alioth.debian.org/ +# +# RELEASE: 2.x + +# This function can be used to access a tokenized list of words +# on the command line: +# +# __git_reassemble_comp_words_by_ref '=:' +# if test "${words_[cword_-1]}" = -w +# then +# ... +# fi +# +# The argument should be a collection of characters from the list of +# word completion separators (COMP_WORDBREAKS) to treat as ordinary +# characters. +# +# This is roughly equivalent to going back in time and setting +# COMP_WORDBREAKS to exclude those characters. The intent is to +# make option types like --date= and : easy to +# recognize by treating each shell word as a single token. +# +# It is best not to set COMP_WORDBREAKS directly because the value is +# shared with other completion scripts. By the time the completion +# function gets called, COMP_WORDS has already been populated so local +# changes to COMP_WORDBREAKS have no effect. +# +# Output: words_, cword_, cur_. + +__git_reassemble_comp_words_by_ref() +{ + local exclude i j first + # Which word separators to exclude? + exclude="${1//[^$COMP_WORDBREAKS]}" + cword_=$COMP_CWORD + if [ -z "$exclude" ]; then + words_=("${COMP_WORDS[@]}") + return + fi + # List of word completion separators has shrunk; + # re-assemble words to complete. + for ((i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)); do + # Append each nonempty word consisting of just + # word separator characters to the current word. + first=t + while + [ $i -gt 0 ] && + [ -n "${COMP_WORDS[$i]}" ] && + # word consists of excluded word separators + [ "${COMP_WORDS[$i]//[^$exclude]}" = "${COMP_WORDS[$i]}" ] + do + # Attach to the previous token, + # unless the previous token is the command name. + if [ $j -ge 2 ] && [ -n "$first" ]; then + ((j--)) + fi + first= + words_[$j]=${words_[j]}${COMP_WORDS[i]} + if [ $i = $COMP_CWORD ]; then + cword_=$j + fi + if (($i < ${#COMP_WORDS[@]} - 1)); then + ((i++)) + else + # Done. + return + fi + done + words_[$j]=${words_[j]}${COMP_WORDS[i]} + if [ $i = $COMP_CWORD ]; then + cword_=$j + fi + done +} + +if ! type _get_comp_words_by_ref >/dev/null 2>&1; then +_get_comp_words_by_ref () +{ + local exclude cur_ words_ cword_ + if [ "$1" = "-n" ]; then + exclude=$2 + shift 2 + fi + __git_reassemble_comp_words_by_ref "$exclude" + cur_=${words_[cword_]} + while [ $# -gt 0 ]; do + case "$1" in + cur) + cur=$cur_ + ;; + prev) + prev=${words_[$cword_-1]} + ;; + words) + words=("${words_[@]}") + ;; + cword) + cword=$cword_ + ;; + esac + shift + done +} +fi + +__gitcompadd () +{ + local i=0 + for x in $1; do + if [[ "$x" == "$3"* ]]; then + COMPREPLY[i++]="$2$x$4" + fi + done +} + +# Generates completion reply, appending a space to possible completion words, +# if necessary. +# It accepts 1 to 4 arguments: +# 1: List of possible completion words. +# 2: A prefix to be added to each possible completion word (optional). +# 3: Generate possible completion matches for this word (optional). +# 4: A suffix to be appended to each possible completion word (optional). +__gitcomp () +{ + local cur_="${3-$cur}" + + case "$cur_" in + --*=) + ;; + *) + local c i=0 IFS=$' \t\n' + for c in $1; do + c="$c${4-}" + if [[ $c == "$cur_"* ]]; then + case $c in + --*=*|*.) ;; + *) c="$c " ;; + esac + COMPREPLY[i++]="${2-}$c" + fi + done + ;; + esac +} + +# Generates completion reply from newline-separated possible completion words +# by appending a space to all of them. +# It accepts 1 to 4 arguments: +# 1: List of possible completion words, separated by a single newline. +# 2: A prefix to be added to each possible completion word (optional). +# 3: Generate possible completion matches for this word (optional). +# 4: A suffix to be appended to each possible completion word instead of +# the default space (optional). If specified but empty, nothing is +# appended. +__gitcomp_nl () +{ + local IFS=$'\n' + __gitcompadd "$1" "${2-}" "${3-$cur}" "${4- }" +} + +# Generates completion reply with compgen from newline-separated possible +# completion filenames. +# It accepts 1 to 3 arguments: +# 1: List of possible completion filenames, separated by a single newline. +# 2: A directory prefix to be added to each possible completion filename +# (optional). +# 3: Generate possible completion matches for this word (optional). +__gitcomp_file () +{ + local IFS=$'\n' + + # XXX does not work when the directory prefix contains a tilde, + # since tilde expansion is not applied. + # This means that COMPREPLY will be empty and Bash default + # completion will be used. + __gitcompadd "$1" "${2-}" "${3-$cur}" "" + + # use a hack to enable file mode in bash < 4 + compopt -o filenames +o nospace 2>/dev/null || + compgen -f /non-existing-dir/ > /dev/null +} + +# Execute 'git ls-files', unless the --committable option is specified, in +# which case it runs 'git diff-index' to find out the files that can be +# committed. It return paths relative to the directory specified in the first +# argument, and using the options specified in the second argument. +__git_ls_files_helper () +{ + ( + test -n "${CDPATH+set}" && unset CDPATH + cd "$1" + if [ "$2" == "--committable" ]; then + git diff-index --name-only --relative HEAD + else + # NOTE: $2 is not quoted in order to support multiple options + git ls-files --exclude-standard $2 + fi + ) 2>/dev/null +} + + +# __git_index_files accepts 1 or 2 arguments: +# 1: Options to pass to ls-files (required). +# 2: A directory path (optional). +# If provided, only files within the specified directory are listed. +# Sub directories are never recursed. Path must have a trailing +# slash. +__git_index_files () +{ + local dir="$(__gitdir)" root="${2-.}" file + + if [ -d "$dir" ]; then + __git_ls_files_helper "$root" "$1" | + while read -r file; do + case "$file" in + ?*/*) echo "${file%%/*}" ;; + *) echo "$file" ;; + esac + done | sort | uniq + fi +} + +__git_heads () +{ + local dir="$(__gitdir)" + if [ -d "$dir" ]; then + git --git-dir="$dir" for-each-ref --format='%(refname:short)' \ + refs/heads + return + fi +} + +__git_tags () +{ + local dir="$(__gitdir)" + if [ -d "$dir" ]; then + git --git-dir="$dir" for-each-ref --format='%(refname:short)' \ + refs/tags + return + fi +} + +# __git_refs accepts 0, 1 (to pass to __gitdir), or 2 arguments +# presence of 2nd argument means use the guess heuristic employed +# by checkout for tracking branches +__git_refs () +{ + local i hash dir="$(__gitdir "${1-}")" track="${2-}" + local format refs + if [ -d "$dir" ]; then + case "$cur" in + refs|refs/*) + format="refname" + refs="${cur%/*}" + track="" + ;; + *) + for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do + if [ -e "$dir/$i" ]; then echo $i; fi + done + format="refname:short" + refs="refs/tags refs/heads refs/remotes" + ;; + esac + git --git-dir="$dir" for-each-ref --format="%($format)" \ + $refs + if [ -n "$track" ]; then + # employ the heuristic used by git checkout + # Try to find a remote branch that matches the completion word + # but only output if the branch name is unique + local ref entry + git --git-dir="$dir" for-each-ref --shell --format="ref=%(refname:short)" \ + "refs/remotes/" | \ + while read -r entry; do + eval "$entry" + ref="${ref#*/}" + if [[ "$ref" == "$cur"* ]]; then + echo "$ref" + fi + done | sort | uniq -u + fi + return + fi + case "$cur" in + refs|refs/*) + git ls-remote "$dir" "$cur*" 2>/dev/null | \ + while read -r hash i; do + case "$i" in + *^{}) ;; + *) echo "$i" ;; + esac + done + ;; + *) + echo "HEAD" + git for-each-ref --format="%(refname:short)" -- "refs/remotes/$dir/" | sed -e "s#^$dir/##" + ;; + esac +} + +# __git_refs2 requires 1 argument (to pass to __git_refs) +__git_refs2 () +{ + local i + for i in $(__git_refs "$1"); do + echo "$i:$i" + done +} + +# __git_refs_remotes requires 1 argument (to pass to ls-remote) +__git_refs_remotes () +{ + local i hash + git ls-remote "$1" 'refs/heads/*' 2>/dev/null | \ + while read -r hash i; do + echo "$i:refs/remotes/$1/${i#refs/heads/}" + done +} + +__git_remotes () +{ + local i IFS=$'\n' d="$(__gitdir)" + test -d "$d/remotes" && ls -1 "$d/remotes" + for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do + i="${i#remote.}" + echo "${i/.url*/}" + done +} + +__git_list_merge_strategies () +{ + git merge -s help 2>&1 | + sed -n -e '/[Aa]vailable strategies are: /,/^$/{ + s/\.$// + s/.*:// + s/^[ ]*// + s/[ ]*$// + p + }' +} + +__git_merge_strategies= +# 'git merge -s help' (and thus detection of the merge strategy +# list) fails, unfortunately, if run outside of any git working +# tree. __git_merge_strategies is set to the empty string in +# that case, and the detection will be repeated the next time it +# is needed. +__git_compute_merge_strategies () +{ + test -n "$__git_merge_strategies" || + __git_merge_strategies=$(__git_list_merge_strategies) +} + +__git_complete_revlist_file () +{ + local pfx ls ref cur_="$cur" + case "$cur_" in + *..?*:*) + return + ;; + ?*:*) + ref="${cur_%%:*}" + cur_="${cur_#*:}" + case "$cur_" in + ?*/*) + pfx="${cur_%/*}" + cur_="${cur_##*/}" + ls="$ref:$pfx" + pfx="$pfx/" + ;; + *) + ls="$ref" + ;; + esac + + case "$COMP_WORDBREAKS" in + *:*) : great ;; + *) pfx="$ref:$pfx" ;; + esac + + __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" 2>/dev/null \ + | sed '/^100... blob /{ + s,^.* ,, + s,$, , + } + /^120000 blob /{ + s,^.* ,, + s,$, , + } + /^040000 tree /{ + s,^.* ,, + s,$,/, + } + s/^.* //')" \ + "$pfx" "$cur_" "" + ;; + *...*) + pfx="${cur_%...*}..." + cur_="${cur_#*...}" + __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + ;; + *..*) + pfx="${cur_%..*}.." + cur_="${cur_#*..}" + __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + ;; + *) + __gitcomp_nl "$(__git_refs)" + ;; + esac +} + + +# __git_complete_index_file requires 1 argument: +# 1: the options to pass to ls-file +# +# The exception is --committable, which finds the files appropriate commit. +__git_complete_index_file () +{ + local pfx="" cur_="$cur" + + case "$cur_" in + ?*/*) + pfx="${cur_%/*}" + cur_="${cur_##*/}" + pfx="${pfx}/" + ;; + esac + + __gitcomp_file "$(__git_index_files "$1" "$pfx")" "$pfx" "$cur_" +} + +__git_complete_file () +{ + __git_complete_revlist_file +} + +__git_complete_revlist () +{ + __git_complete_revlist_file +} + +__git_complete_remote_or_refspec () +{ + local cur_="$cur" cmd="${words[1]}" + local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0 + if [ "$cmd" = "remote" ]; then + ((c++)) + fi + while [ $c -lt $cword ]; do + i="${words[c]}" + case "$i" in + --mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;; + --all) + case "$cmd" in + push) no_complete_refspec=1 ;; + fetch) + return + ;; + *) ;; + esac + ;; + -*) ;; + *) remote="$i"; break ;; + esac + ((c++)) + done + if [ -z "$remote" ]; then + __gitcomp_nl "$(__git_remotes)" + return + fi + if [ $no_complete_refspec = 1 ]; then + return + fi + [ "$remote" = "." ] && remote= + case "$cur_" in + *:*) + case "$COMP_WORDBREAKS" in + *:*) : great ;; + *) pfx="${cur_%%:*}:" ;; + esac + cur_="${cur_#*:}" + lhs=0 + ;; + +*) + pfx="+" + cur_="${cur_#+}" + ;; + esac + case "$cmd" in + fetch) + if [ $lhs = 1 ]; then + __gitcomp_nl "$(__git_refs2 "$remote")" "$pfx" "$cur_" + else + __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + fi + ;; + pull|remote) + if [ $lhs = 1 ]; then + __gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_" + else + __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + fi + ;; + push) + if [ $lhs = 1 ]; then + __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_" + else + __gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_" + fi + ;; + esac +} + +__git_complete_strategy () +{ + __git_compute_merge_strategies + case "$prev" in + -s|--strategy) + __gitcomp "$__git_merge_strategies" + return 0 + esac + case "$cur" in + --strategy=*) + __gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}" + return 0 + ;; + esac + return 1 +} + +__git_commands () { + if test -n "${GIT_TESTING_COMMAND_COMPLETION:-}" + then + printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}" + else + git help -a|egrep '^ [a-zA-Z0-9]' + fi +} + +__git_list_all_commands () +{ + local i IFS=" "$'\n' + for i in $(__git_commands) + do + case $i in + *--*) : helper pattern;; + *) echo $i;; + esac + done +} + +__git_all_commands= +__git_compute_all_commands () +{ + test -n "$__git_all_commands" || + __git_all_commands=$(__git_list_all_commands) +} + +__git_list_porcelain_commands () +{ + local i IFS=" "$'\n' + __git_compute_all_commands + for i in $__git_all_commands + do + case $i in + *--*) : helper pattern;; + applymbox) : ask gittus;; + applypatch) : ask gittus;; + archimport) : import;; + cat-file) : plumbing;; + check-attr) : plumbing;; + check-ignore) : plumbing;; + check-mailmap) : plumbing;; + check-ref-format) : plumbing;; + checkout-index) : plumbing;; + commit-tree) : plumbing;; + count-objects) : infrequent;; + credential-cache) : credentials helper;; + credential-store) : credentials helper;; + cvsexportcommit) : export;; + cvsimport) : import;; + cvsserver) : daemon;; + daemon) : daemon;; + diff-files) : plumbing;; + diff-index) : plumbing;; + diff-tree) : plumbing;; + fast-import) : import;; + fast-export) : export;; + fsck-objects) : plumbing;; + fetch-pack) : plumbing;; + fmt-merge-msg) : plumbing;; + for-each-ref) : plumbing;; + hash-object) : plumbing;; + http-*) : transport;; + index-pack) : plumbing;; + init-db) : deprecated;; + local-fetch) : plumbing;; + lost-found) : infrequent;; + ls-files) : plumbing;; + ls-remote) : plumbing;; + ls-tree) : plumbing;; + mailinfo) : plumbing;; + mailsplit) : plumbing;; + merge-*) : plumbing;; + mktree) : plumbing;; + mktag) : plumbing;; + pack-objects) : plumbing;; + pack-redundant) : plumbing;; + pack-refs) : plumbing;; + parse-remote) : plumbing;; + patch-id) : plumbing;; + peek-remote) : plumbing;; + prune) : plumbing;; + prune-packed) : plumbing;; + quiltimport) : import;; + read-tree) : plumbing;; + receive-pack) : plumbing;; + remote-*) : transport;; + repo-config) : deprecated;; + rerere) : plumbing;; + rev-list) : plumbing;; + rev-parse) : plumbing;; + runstatus) : plumbing;; + sh-setup) : internal;; + shell) : daemon;; + show-ref) : plumbing;; + send-pack) : plumbing;; + show-index) : plumbing;; + ssh-*) : transport;; + stripspace) : plumbing;; + symbolic-ref) : plumbing;; + tar-tree) : deprecated;; + unpack-file) : plumbing;; + unpack-objects) : plumbing;; + update-index) : plumbing;; + update-ref) : plumbing;; + update-server-info) : daemon;; + upload-archive) : plumbing;; + upload-pack) : plumbing;; + write-tree) : plumbing;; + var) : infrequent;; + verify-pack) : infrequent;; + verify-tag) : plumbing;; + *) echo $i;; + esac + done +} + +__git_porcelain_commands= +__git_compute_porcelain_commands () +{ + __git_compute_all_commands + test -n "$__git_porcelain_commands" || + __git_porcelain_commands=$(__git_list_porcelain_commands) +} + +__git_pretty_aliases () +{ + local i IFS=$'\n' + for i in $(git --git-dir="$(__gitdir)" config --get-regexp "pretty\..*" 2>/dev/null); do + case "$i" in + pretty.*) + i="${i#pretty.}" + echo "${i/ */}" + ;; + esac + done +} + +__git_aliases () +{ + local i IFS=$'\n' + for i in $(git --git-dir="$(__gitdir)" config --get-regexp "alias\..*" 2>/dev/null); do + case "$i" in + alias.*) + i="${i#alias.}" + echo "${i/ */}" + ;; + esac + done +} + +# __git_aliased_command requires 1 argument +__git_aliased_command () +{ + local word cmdline=$(git --git-dir="$(__gitdir)" \ + config --get "alias.$1") + for word in $cmdline; do + case "$word" in + \!gitk|gitk) + echo "gitk" + return + ;; + \!*) : shell command alias ;; + -*) : option ;; + *=*) : setting env ;; + git) : git itself ;; + *) + echo "$word" + return + esac + done +} + +# __git_find_on_cmdline requires 1 argument +__git_find_on_cmdline () +{ + local word subcommand c=1 + while [ $c -lt $cword ]; do + word="${words[c]}" + for subcommand in $1; do + if [ "$subcommand" = "$word" ]; then + echo "$subcommand" + return + fi + done + ((c++)) + done +} + +__git_has_doubledash () +{ + local c=1 + while [ $c -lt $cword ]; do + if [ "--" = "${words[c]}" ]; then + return 0 + fi + ((c++)) + done + return 1 +} + +# Try to count non option arguments passed on the command line for the +# specified git command. +# When options are used, it is necessary to use the special -- option to +# tell the implementation were non option arguments begin. +# XXX this can not be improved, since options can appear everywhere, as +# an example: +# git mv x -n y +# +# __git_count_arguments requires 1 argument: the git command executed. +__git_count_arguments () +{ + local word i c=0 + + # Skip "git" (first argument) + for ((i=1; i < ${#words[@]}; i++)); do + word="${words[i]}" + + case "$word" in + --) + # Good; we can assume that the following are only non + # option arguments. + ((c = 0)) + ;; + "$1") + # Skip the specified git command and discard git + # main options + ((c = 0)) + ;; + ?*) + ((c++)) + ;; + esac + done + + printf "%d" $c +} + +__git_whitespacelist="nowarn warn error error-all fix" + +_git_am () +{ + local dir="$(__gitdir)" + if [ -d "$dir"/rebase-apply ]; then + __gitcomp "--skip --continue --resolved --abort" + return + fi + case "$cur" in + --whitespace=*) + __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" + return + ;; + --*) + __gitcomp " + --3way --committer-date-is-author-date --ignore-date + --ignore-whitespace --ignore-space-change + --interactive --keep --no-utf8 --signoff --utf8 + --whitespace= --scissors + " + return + esac +} + +_git_apply () +{ + case "$cur" in + --whitespace=*) + __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" + return + ;; + --*) + __gitcomp " + --stat --numstat --summary --check --index + --cached --index-info --reverse --reject --unidiff-zero + --apply --no-add --exclude= + --ignore-whitespace --ignore-space-change + --whitespace= --inaccurate-eof --verbose + " + return + esac +} + +_git_add () +{ + case "$cur" in + --*) + __gitcomp " + --interactive --refresh --patch --update --dry-run + --ignore-errors --intent-to-add + " + return + esac + + # XXX should we check for --update and --all options ? + __git_complete_index_file "--others --modified" +} + +_git_archive () +{ + case "$cur" in + --format=*) + __gitcomp "$(git archive --list)" "" "${cur##--format=}" + return + ;; + --remote=*) + __gitcomp_nl "$(__git_remotes)" "" "${cur##--remote=}" + return + ;; + --*) + __gitcomp " + --format= --list --verbose + --prefix= --remote= --exec= + " + return + ;; + esac + __git_complete_file +} + +_git_bisect () +{ + __git_has_doubledash && return + + local subcommands="start bad good skip reset visualize replay log run" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + if [ -f "$(__gitdir)"/BISECT_START ]; then + __gitcomp "$subcommands" + else + __gitcomp "replay start" + fi + return + fi + + case "$subcommand" in + bad|good|reset|skip|start) + __gitcomp_nl "$(__git_refs)" + ;; + *) + ;; + esac +} + +_git_branch () +{ + local i c=1 only_local_ref="n" has_r="n" + + while [ $c -lt $cword ]; do + i="${words[c]}" + case "$i" in + -d|-m) only_local_ref="y" ;; + -r) has_r="y" ;; + esac + ((c++)) + done + + case "$cur" in + --set-upstream-to=*) + __gitcomp "$(__git_refs)" "" "${cur##--set-upstream-to=}" + ;; + --*) + __gitcomp " + --color --no-color --verbose --abbrev= --no-abbrev + --track --no-track --contains --merged --no-merged + --set-upstream-to= --edit-description --list + --unset-upstream + " + ;; + *) + if [ $only_local_ref = "y" -a $has_r = "n" ]; then + __gitcomp_nl "$(__git_heads)" + else + __gitcomp_nl "$(__git_refs)" + fi + ;; + esac +} + +_git_bundle () +{ + local cmd="${words[2]}" + case "$cword" in + 2) + __gitcomp "create list-heads verify unbundle" + ;; + 3) + # looking for a file + ;; + *) + case "$cmd" in + create) + __git_complete_revlist + ;; + esac + ;; + esac +} + +_git_checkout () +{ + __git_has_doubledash && return + + case "$cur" in + --conflict=*) + __gitcomp "diff3 merge" "" "${cur##--conflict=}" + ;; + --*) + __gitcomp " + --quiet --ours --theirs --track --no-track --merge + --conflict= --orphan --patch + " + ;; + *) + # check if --track, --no-track, or --no-guess was specified + # if so, disable DWIM mode + local flags="--track --no-track --no-guess" track=1 + if [ -n "$(__git_find_on_cmdline "$flags")" ]; then + track='' + fi + __gitcomp_nl "$(__git_refs '' $track)" + ;; + esac +} + +_git_cherry () +{ + __gitcomp "$(__git_refs)" +} + +_git_cherry_pick () +{ + local dir="$(__gitdir)" + if [ -f "$dir"/CHERRY_PICK_HEAD ]; then + __gitcomp "--continue --quit --abort" + return + fi + case "$cur" in + --*) + __gitcomp "--edit --no-commit --signoff --strategy= --mainline" + ;; + *) + __gitcomp_nl "$(__git_refs)" + ;; + esac +} + +_git_clean () +{ + case "$cur" in + --*) + __gitcomp "--dry-run --quiet" + return + ;; + esac + + # XXX should we check for -x option ? + __git_complete_index_file "--others" +} + +_git_clone () +{ + case "$cur" in + --*) + __gitcomp " + --local + --no-hardlinks + --shared + --reference + --quiet + --no-checkout + --bare + --mirror + --origin + --upload-pack + --template= + --depth + --single-branch + --branch + " + return + ;; + esac +} + +_git_commit () +{ + case "$prev" in + -c|-C) + __gitcomp_nl "$(__git_refs)" "" "${cur}" + return + ;; + esac + + case "$cur" in + --cleanup=*) + __gitcomp "default strip verbatim whitespace + " "" "${cur##--cleanup=}" + return + ;; + --reuse-message=*|--reedit-message=*|\ + --fixup=*|--squash=*) + __gitcomp_nl "$(__git_refs)" "" "${cur#*=}" + return + ;; + --untracked-files=*) + __gitcomp "all no normal" "" "${cur##--untracked-files=}" + return + ;; + --*) + __gitcomp " + --all --author= --signoff --verify --no-verify + --edit --no-edit + --amend --include --only --interactive + --dry-run --reuse-message= --reedit-message= + --reset-author --file= --message= --template= + --cleanup= --untracked-files --untracked-files= + --verbose --quiet --fixup= --squash= + " + return + esac + + if git rev-parse --verify --quiet HEAD >/dev/null; then + __git_complete_index_file "--committable" + else + # This is the first commit + __git_complete_index_file "--cached" + fi +} + +_git_describe () +{ + case "$cur" in + --*) + __gitcomp " + --all --tags --contains --abbrev= --candidates= + --exact-match --debug --long --match --always + " + return + esac + __gitcomp_nl "$(__git_refs)" +} + +__git_diff_algorithms="myers minimal patience histogram" + +__git_diff_common_options="--stat --numstat --shortstat --summary + --patch-with-stat --name-only --name-status --color + --no-color --color-words --no-renames --check + --full-index --binary --abbrev --diff-filter= + --find-copies-harder + --text --ignore-space-at-eol --ignore-space-change + --ignore-all-space --exit-code --quiet --ext-diff + --no-ext-diff + --no-prefix --src-prefix= --dst-prefix= + --inter-hunk-context= + --patience --histogram --minimal + --raw --word-diff + --dirstat --dirstat= --dirstat-by-file + --dirstat-by-file= --cumulative + --diff-algorithm= +" + +_git_diff () +{ + __git_has_doubledash && return + + case "$cur" in + --diff-algorithm=*) + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" + return + ;; + --*) + __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex + --base --ours --theirs --no-index + $__git_diff_common_options + " + return + ;; + esac + __git_complete_revlist_file +} + +__git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff + tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3 codecompare +" + +_git_difftool () +{ + __git_has_doubledash && return + + case "$cur" in + --tool=*) + __gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}" + return + ;; + --*) + __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex + --base --ours --theirs + --no-renames --diff-filter= --find-copies-harder + --relative --ignore-submodules + --tool=" + return + ;; + esac + __git_complete_revlist_file +} + +__git_fetch_options=" + --quiet --verbose --append --upload-pack --force --keep --depth= + --tags --no-tags --all --prune --dry-run +" + +_git_fetch () +{ + case "$cur" in + --*) + __gitcomp "$__git_fetch_options" + return + ;; + esac + __git_complete_remote_or_refspec +} + +__git_format_patch_options=" + --stdout --attach --no-attach --thread --thread= --no-thread + --numbered --start-number --numbered-files --keep-subject --signoff + --signature --no-signature --in-reply-to= --cc= --full-index --binary + --not --all --cover-letter --no-prefix --src-prefix= --dst-prefix= + --inline --suffix= --ignore-if-in-upstream --subject-prefix= + --output-directory --reroll-count --to= --quiet --notes +" + +_git_format_patch () +{ + case "$cur" in + --thread=*) + __gitcomp " + deep shallow + " "" "${cur##--thread=}" + return + ;; + --*) + __gitcomp "$__git_format_patch_options" + return + ;; + esac + __git_complete_revlist +} + +_git_fsck () +{ + case "$cur" in + --*) + __gitcomp " + --tags --root --unreachable --cache --no-reflogs --full + --strict --verbose --lost-found + " + return + ;; + esac +} + +_git_gc () +{ + case "$cur" in + --*) + __gitcomp "--prune --aggressive" + return + ;; + esac +} + +_git_gitk () +{ + _gitk +} + +__git_match_ctag() { + awk "/^${1////\\/}/ { print \$1 }" "$2" +} + +_git_grep () +{ + __git_has_doubledash && return + + case "$cur" in + --*) + __gitcomp " + --cached + --text --ignore-case --word-regexp --invert-match + --full-name --line-number + --extended-regexp --basic-regexp --fixed-strings + --perl-regexp + --files-with-matches --name-only + --files-without-match + --max-depth + --count + --and --or --not --all-match + " + return + ;; + esac + + case "$cword,$prev" in + 2,*|*,-*) + if test -r tags; then + __gitcomp_nl "$(__git_match_ctag "$cur" tags)" + return + fi + ;; + esac + + __gitcomp_nl "$(__git_refs)" +} + +_git_help () +{ + case "$cur" in + --*) + __gitcomp "--all --info --man --web" + return + ;; + esac + __git_compute_all_commands + __gitcomp "$__git_all_commands $(__git_aliases) + attributes cli core-tutorial cvs-migration + diffcore gitk glossary hooks ignore modules + namespaces repository-layout tutorial tutorial-2 + workflows + " +} + +_git_init () +{ + case "$cur" in + --shared=*) + __gitcomp " + false true umask group all world everybody + " "" "${cur##--shared=}" + return + ;; + --*) + __gitcomp "--quiet --bare --template= --shared --shared=" + return + ;; + esac +} + +_git_ls_files () +{ + case "$cur" in + --*) + __gitcomp "--cached --deleted --modified --others --ignored + --stage --directory --no-empty-directory --unmerged + --killed --exclude= --exclude-from= + --exclude-per-directory= --exclude-standard + --error-unmatch --with-tree= --full-name + --abbrev --ignored --exclude-per-directory + " + return + ;; + esac + + # XXX ignore options like --modified and always suggest all cached + # files. + __git_complete_index_file "--cached" +} + +_git_ls_remote () +{ + __gitcomp_nl "$(__git_remotes)" +} + +_git_ls_tree () +{ + __git_complete_file +} + +# Options that go well for log, shortlog and gitk +__git_log_common_options=" + --not --all + --branches --tags --remotes + --first-parent --merges --no-merges + --max-count= + --max-age= --since= --after= + --min-age= --until= --before= + --min-parents= --max-parents= + --no-min-parents --no-max-parents +" +# Options that go well for log and gitk (not shortlog) +__git_log_gitk_options=" + --dense --sparse --full-history + --simplify-merges --simplify-by-decoration + --left-right --notes --no-notes +" +# Options that go well for log and shortlog (not gitk) +__git_log_shortlog_options=" + --author= --committer= --grep= + --all-match +" + +__git_log_pretty_formats="oneline short medium full fuller email raw format:" +__git_log_date_formats="relative iso8601 rfc2822 short local default raw" + +_git_log () +{ + __git_has_doubledash && return + + local g="$(git rev-parse --git-dir 2>/dev/null)" + local merge="" + if [ -f "$g/MERGE_HEAD" ]; then + merge="--merge" + fi + case "$cur" in + --pretty=*|--format=*) + __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) + " "" "${cur#*=}" + return + ;; + --date=*) + __gitcomp "$__git_log_date_formats" "" "${cur##--date=}" + return + ;; + --decorate=*) + __gitcomp "long short" "" "${cur##--decorate=}" + return + ;; + --*) + __gitcomp " + $__git_log_common_options + $__git_log_shortlog_options + $__git_log_gitk_options + --root --topo-order --date-order --reverse + --follow --full-diff + --abbrev-commit --abbrev= + --relative-date --date= + --pretty= --format= --oneline + --cherry-pick + --graph + --decorate --decorate= + --walk-reflogs + --parents --children + $merge + $__git_diff_common_options + --pickaxe-all --pickaxe-regex + " + return + ;; + esac + __git_complete_revlist +} + +__git_merge_options=" + --no-commit --no-stat --log --no-log --squash --strategy + --commit --stat --no-squash --ff --no-ff --ff-only --edit --no-edit +" + +_git_merge () +{ + __git_complete_strategy && return + + case "$cur" in + --*) + __gitcomp "$__git_merge_options" + return + esac + __gitcomp_nl "$(__git_refs)" +} + +_git_mergetool () +{ + case "$cur" in + --tool=*) + __gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}" + return + ;; + --*) + __gitcomp "--tool=" + return + ;; + esac +} + +_git_merge_base () +{ + __gitcomp_nl "$(__git_refs)" +} + +_git_mv () +{ + case "$cur" in + --*) + __gitcomp "--dry-run" + return + ;; + esac + + if [ $(__git_count_arguments "mv") -gt 0 ]; then + # We need to show both cached and untracked files (including + # empty directories) since this may not be the last argument. + __git_complete_index_file "--cached --others --directory" + else + __git_complete_index_file "--cached" + fi +} + +_git_name_rev () +{ + __gitcomp "--tags --all --stdin" +} + +_git_notes () +{ + local subcommands='add append copy edit list prune remove show' + local subcommand="$(__git_find_on_cmdline "$subcommands")" + + case "$subcommand,$cur" in + ,--*) + __gitcomp '--ref' + ;; + ,*) + case "$prev" in + --ref) + __gitcomp_nl "$(__git_refs)" + ;; + *) + __gitcomp "$subcommands --ref" + ;; + esac + ;; + add,--reuse-message=*|append,--reuse-message=*|\ + add,--reedit-message=*|append,--reedit-message=*) + __gitcomp_nl "$(__git_refs)" "" "${cur#*=}" + ;; + add,--*|append,--*) + __gitcomp '--file= --message= --reedit-message= + --reuse-message=' + ;; + copy,--*) + __gitcomp '--stdin' + ;; + prune,--*) + __gitcomp '--dry-run --verbose' + ;; + prune,*) + ;; + *) + case "$prev" in + -m|-F) + ;; + *) + __gitcomp_nl "$(__git_refs)" + ;; + esac + ;; + esac +} + +_git_pull () +{ + __git_complete_strategy && return + + case "$cur" in + --*) + __gitcomp " + --rebase --no-rebase + $__git_merge_options + $__git_fetch_options + " + return + ;; + esac + __git_complete_remote_or_refspec +} + +_git_push () +{ + case "$prev" in + --repo) + __gitcomp_nl "$(__git_remotes)" + return + esac + case "$cur" in + --repo=*) + __gitcomp_nl "$(__git_remotes)" "" "${cur##--repo=}" + return + ;; + --*) + __gitcomp " + --all --mirror --tags --dry-run --force --verbose + --receive-pack= --repo= --set-upstream + " + return + ;; + esac + __git_complete_remote_or_refspec +} + +_git_rebase () +{ + local dir="$(__gitdir)" + if [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then + __gitcomp "--continue --skip --abort" + return + fi + __git_complete_strategy && return + case "$cur" in + --whitespace=*) + __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" + return + ;; + --*) + __gitcomp " + --onto --merge --strategy --interactive + --preserve-merges --stat --no-stat + --committer-date-is-author-date --ignore-date + --ignore-whitespace --whitespace= + --autosquash + " + + return + esac + __gitcomp_nl "$(__git_refs)" +} + +_git_reflog () +{ + local subcommands="show delete expire" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + else + __gitcomp_nl "$(__git_refs)" + fi +} + +__git_send_email_confirm_options="always never auto cc compose" +__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all" + +_git_send_email () +{ + case "$cur" in + --confirm=*) + __gitcomp " + $__git_send_email_confirm_options + " "" "${cur##--confirm=}" + return + ;; + --suppress-cc=*) + __gitcomp " + $__git_send_email_suppresscc_options + " "" "${cur##--suppress-cc=}" + + return + ;; + --smtp-encryption=*) + __gitcomp "ssl tls" "" "${cur##--smtp-encryption=}" + return + ;; + --thread=*) + __gitcomp " + deep shallow + " "" "${cur##--thread=}" + return + ;; + --*) + __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to + --compose --confirm= --dry-run --envelope-sender + --from --identity + --in-reply-to --no-chain-reply-to --no-signed-off-by-cc + --no-suppress-from --no-thread --quiet + --signed-off-by-cc --smtp-pass --smtp-server + --smtp-server-port --smtp-encryption= --smtp-user + --subject --suppress-cc= --suppress-from --thread --to + --validate --no-validate + $__git_format_patch_options" + return + ;; + esac + __git_complete_revlist +} + +_git_stage () +{ + _git_add +} + +__git_config_get_set_variables () +{ + local prevword word config_file= c=$cword + while [ $c -gt 1 ]; do + word="${words[c]}" + case "$word" in + --system|--global|--local|--file=*) + config_file="$word" + break + ;; + -f|--file) + config_file="$word $prevword" + break + ;; + esac + prevword=$word + c=$((--c)) + done + + git --git-dir="$(__gitdir)" config $config_file --list 2>/dev/null | + while read -r line + do + case "$line" in + *.*=*) + echo "${line/=*/}" + ;; + esac + done +} + +_git_config () +{ + case "$prev" in + branch.*.remote|branch.*.pushremote) + __gitcomp_nl "$(__git_remotes)" + return + ;; + branch.*.merge) + __gitcomp_nl "$(__git_refs)" + return + ;; + branch.*.rebase) + __gitcomp "false true" + return + ;; + remote.pushdefault) + __gitcomp_nl "$(__git_remotes)" + return + ;; + remote.*.fetch) + local remote="${prev#remote.}" + remote="${remote%.fetch}" + if [ -z "$cur" ]; then + __gitcomp_nl "refs/heads/" "" "" "" + return + fi + __gitcomp_nl "$(__git_refs_remotes "$remote")" + return + ;; + remote.*.push) + local remote="${prev#remote.}" + remote="${remote%.push}" + __gitcomp_nl "$(git --git-dir="$(__gitdir)" \ + for-each-ref --format='%(refname):%(refname)' \ + refs/heads)" + return + ;; + pull.twohead|pull.octopus) + __git_compute_merge_strategies + __gitcomp "$__git_merge_strategies" + return + ;; + color.branch|color.diff|color.interactive|\ + color.showbranch|color.status|color.ui) + __gitcomp "always never auto" + return + ;; + color.pager) + __gitcomp "false true" + return + ;; + color.*.*) + __gitcomp " + normal black red green yellow blue magenta cyan white + bold dim ul blink reverse + " + return + ;; + diff.submodule) + __gitcomp "log short" + return + ;; + help.format) + __gitcomp "man info web html" + return + ;; + log.date) + __gitcomp "$__git_log_date_formats" + return + ;; + sendemail.aliasesfiletype) + __gitcomp "mutt mailrc pine elm gnus" + return + ;; + sendemail.confirm) + __gitcomp "$__git_send_email_confirm_options" + return + ;; + sendemail.suppresscc) + __gitcomp "$__git_send_email_suppresscc_options" + return + ;; + --get|--get-all|--unset|--unset-all) + __gitcomp_nl "$(__git_config_get_set_variables)" + return + ;; + *.*) + return + ;; + esac + case "$cur" in + --*) + __gitcomp " + --system --global --local --file= + --list --replace-all + --get --get-all --get-regexp + --add --unset --unset-all + --remove-section --rename-section + " + return + ;; + branch.*.*) + local pfx="${cur%.*}." cur_="${cur##*.}" + __gitcomp "remote pushremote merge mergeoptions rebase" "$pfx" "$cur_" + return + ;; + branch.*) + local pfx="${cur%.*}." cur_="${cur#*.}" + __gitcomp_nl "$(__git_heads)" "$pfx" "$cur_" "." + return + ;; + guitool.*.*) + local pfx="${cur%.*}." cur_="${cur##*.}" + __gitcomp " + argprompt cmd confirm needsfile noconsole norescan + prompt revprompt revunmerged title + " "$pfx" "$cur_" + return + ;; + difftool.*.*) + local pfx="${cur%.*}." cur_="${cur##*.}" + __gitcomp "cmd path" "$pfx" "$cur_" + return + ;; + man.*.*) + local pfx="${cur%.*}." cur_="${cur##*.}" + __gitcomp "cmd path" "$pfx" "$cur_" + return + ;; + mergetool.*.*) + local pfx="${cur%.*}." cur_="${cur##*.}" + __gitcomp "cmd path trustExitCode" "$pfx" "$cur_" + return + ;; + pager.*) + local pfx="${cur%.*}." cur_="${cur#*.}" + __git_compute_all_commands + __gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" + return + ;; + remote.*.*) + local pfx="${cur%.*}." cur_="${cur##*.}" + __gitcomp " + url proxy fetch push mirror skipDefaultUpdate + receivepack uploadpack tagopt pushurl + " "$pfx" "$cur_" + return + ;; + remote.*) + local pfx="${cur%.*}." cur_="${cur#*.}" + __gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "." + return + ;; + url.*.*) + local pfx="${cur%.*}." cur_="${cur##*.}" + __gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_" + return + ;; + esac + __gitcomp " + add.ignoreErrors + advice.commitBeforeMerge + advice.detachedHead + advice.implicitIdentity + advice.pushNonFastForward + advice.resolveConflict + advice.statusHints + alias. + am.keepcr + apply.ignorewhitespace + apply.whitespace + branch.autosetupmerge + branch.autosetuprebase + browser. + clean.requireForce + color.branch + color.branch.current + color.branch.local + color.branch.plain + color.branch.remote + color.decorate.HEAD + color.decorate.branch + color.decorate.remoteBranch + color.decorate.stash + color.decorate.tag + color.diff + color.diff.commit + color.diff.frag + color.diff.func + color.diff.meta + color.diff.new + color.diff.old + color.diff.plain + color.diff.whitespace + color.grep + color.grep.context + color.grep.filename + color.grep.function + color.grep.linenumber + color.grep.match + color.grep.selected + color.grep.separator + color.interactive + color.interactive.error + color.interactive.header + color.interactive.help + color.interactive.prompt + color.pager + color.showbranch + color.status + color.status.added + color.status.changed + color.status.header + color.status.nobranch + color.status.untracked + color.status.updated + color.ui + commit.status + commit.template + core.abbrev + core.askpass + core.attributesfile + core.autocrlf + core.bare + core.bigFileThreshold + core.compression + core.createObject + core.deltaBaseCacheLimit + core.editor + core.eol + core.excludesfile + core.fileMode + core.fsyncobjectfiles + core.gitProxy + core.ignoreStat + core.ignorecase + core.logAllRefUpdates + core.loosecompression + core.notesRef + core.packedGitLimit + core.packedGitWindowSize + core.pager + core.preferSymlinkRefs + core.preloadindex + core.quotepath + core.repositoryFormatVersion + core.safecrlf + core.sharedRepository + core.sparseCheckout + core.symlinks + core.trustctime + core.warnAmbiguousRefs + core.whitespace + core.worktree + diff.autorefreshindex + diff.external + diff.ignoreSubmodules + diff.mnemonicprefix + diff.noprefix + diff.renameLimit + diff.renames + diff.statGraphWidth + diff.submodule + diff.suppressBlankEmpty + diff.tool + diff.wordRegex + diff.algorithm + difftool. + difftool.prompt + fetch.recurseSubmodules + fetch.unpackLimit + format.attach + format.cc + format.headers + format.numbered + format.pretty + format.signature + format.signoff + format.subjectprefix + format.suffix + format.thread + format.to + gc. + gc.aggressiveWindow + gc.auto + gc.autopacklimit + gc.packrefs + gc.pruneexpire + gc.reflogexpire + gc.reflogexpireunreachable + gc.rerereresolved + gc.rerereunresolved + gitcvs.allbinary + gitcvs.commitmsgannotation + gitcvs.dbTableNamePrefix + gitcvs.dbdriver + gitcvs.dbname + gitcvs.dbpass + gitcvs.dbuser + gitcvs.enabled + gitcvs.logfile + gitcvs.usecrlfattr + guitool. + gui.blamehistoryctx + gui.commitmsgwidth + gui.copyblamethreshold + gui.diffcontext + gui.encoding + gui.fastcopyblame + gui.matchtrackingbranch + gui.newbranchtemplate + gui.pruneduringfetch + gui.spellingdictionary + gui.trustmtime + help.autocorrect + help.browser + help.format + http.lowSpeedLimit + http.lowSpeedTime + http.maxRequests + http.minSessions + http.noEPSV + http.postBuffer + http.proxy + http.sslCAInfo + http.sslCAPath + http.sslCert + http.sslCertPasswordProtected + http.sslKey + http.sslVerify + http.useragent + i18n.commitEncoding + i18n.logOutputEncoding + imap.authMethod + imap.folder + imap.host + imap.pass + imap.port + imap.preformattedHTML + imap.sslverify + imap.tunnel + imap.user + init.templatedir + instaweb.browser + instaweb.httpd + instaweb.local + instaweb.modulepath + instaweb.port + interactive.singlekey + log.date + log.decorate + log.showroot + mailmap.file + man. + man.viewer + merge. + merge.conflictstyle + merge.log + merge.renameLimit + merge.renormalize + merge.stat + merge.tool + merge.verbosity + mergetool. + mergetool.keepBackup + mergetool.keepTemporaries + mergetool.prompt + notes.displayRef + notes.rewrite. + notes.rewrite.amend + notes.rewrite.rebase + notes.rewriteMode + notes.rewriteRef + pack.compression + pack.deltaCacheLimit + pack.deltaCacheSize + pack.depth + pack.indexVersion + pack.packSizeLimit + pack.threads + pack.window + pack.windowMemory + pager. + pretty. + pull.octopus + pull.twohead + push.default + rebase.autosquash + rebase.stat + receive.autogc + receive.denyCurrentBranch + receive.denyDeleteCurrent + receive.denyDeletes + receive.denyNonFastForwards + receive.fsckObjects + receive.unpackLimit + receive.updateserverinfo + remote.pushdefault + remotes. + repack.usedeltabaseoffset + rerere.autoupdate + rerere.enabled + sendemail. + sendemail.aliasesfile + sendemail.aliasfiletype + sendemail.bcc + sendemail.cc + sendemail.cccmd + sendemail.chainreplyto + sendemail.confirm + sendemail.envelopesender + sendemail.from + sendemail.identity + sendemail.multiedit + sendemail.signedoffbycc + sendemail.smtpdomain + sendemail.smtpencryption + sendemail.smtppass + sendemail.smtpserver + sendemail.smtpserveroption + sendemail.smtpserverport + sendemail.smtpuser + sendemail.suppresscc + sendemail.suppressfrom + sendemail.thread + sendemail.to + sendemail.validate + showbranch.default + status.relativePaths + status.showUntrackedFiles + status.submodulesummary + submodule. + tar.umask + transfer.unpackLimit + url. + user.email + user.name + user.signingkey + web.browser + branch. remote. + " +} + +_git_remote () +{ + local subcommands="add rename remove set-head set-branches set-url show prune update" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + return + fi + + case "$subcommand" in + rename|remove|set-url|show|prune) + __gitcomp_nl "$(__git_remotes)" + ;; + set-head|set-branches) + __git_complete_remote_or_refspec + ;; + update) + local i c='' IFS=$'\n' + for i in $(git --git-dir="$(__gitdir)" config --get-regexp "remotes\..*" 2>/dev/null); do + i="${i#remotes.}" + c="$c ${i/ */}" + done + __gitcomp "$c" + ;; + *) + ;; + esac +} + +_git_replace () +{ + __gitcomp_nl "$(__git_refs)" +} + +_git_reset () +{ + __git_has_doubledash && return + + case "$cur" in + --*) + __gitcomp "--merge --mixed --hard --soft --patch" + return + ;; + esac + __gitcomp_nl "$(__git_refs)" +} + +_git_revert () +{ + case "$cur" in + --*) + __gitcomp "--edit --mainline --no-edit --no-commit --signoff" + return + ;; + esac + __gitcomp_nl "$(__git_refs)" +} + +_git_rm () +{ + case "$cur" in + --*) + __gitcomp "--cached --dry-run --ignore-unmatch --quiet" + return + ;; + esac + + __git_complete_index_file "--cached" +} + +_git_shortlog () +{ + __git_has_doubledash && return + + case "$cur" in + --*) + __gitcomp " + $__git_log_common_options + $__git_log_shortlog_options + --numbered --summary + " + return + ;; + esac + __git_complete_revlist +} + +_git_show () +{ + __git_has_doubledash && return + + case "$cur" in + --pretty=*|--format=*) + __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) + " "" "${cur#*=}" + return + ;; + --diff-algorithm=*) + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" + return + ;; + --*) + __gitcomp "--pretty= --format= --abbrev-commit --oneline + $__git_diff_common_options + " + return + ;; + esac + __git_complete_revlist_file +} + +_git_show_branch () +{ + case "$cur" in + --*) + __gitcomp " + --all --remotes --topo-order --current --more= + --list --independent --merge-base --no-name + --color --no-color + --sha1-name --sparse --topics --reflog + " + return + ;; + esac + __git_complete_revlist +} + +_git_stash () +{ + local save_opts='--keep-index --no-keep-index --quiet --patch' + local subcommands='save list show apply clear drop pop create branch' + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + case "$cur" in + --*) + __gitcomp "$save_opts" + ;; + *) + if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then + __gitcomp "$subcommands" + fi + ;; + esac + else + case "$subcommand,$cur" in + save,--*) + __gitcomp "$save_opts" + ;; + apply,--*|pop,--*) + __gitcomp "--index --quiet" + ;; + show,--*|drop,--*|branch,--*) + ;; + show,*|apply,*|drop,*|pop,*|branch,*) + __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \ + | sed -n -e 's/:.*//p')" + ;; + *) + ;; + esac + fi +} + +_git_submodule () +{ + __git_has_doubledash && return + + local subcommands="add status init deinit update summary foreach sync" + if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then + case "$cur" in + --*) + __gitcomp "--quiet --cached" + ;; + *) + __gitcomp "$subcommands" + ;; + esac + return + fi +} + +_git_svn () +{ + local subcommands=" + init fetch clone rebase dcommit log find-rev + set-tree commit-diff info create-ignore propget + proplist show-ignore show-externals branch tag blame + migrate mkdirs reset gc + " + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + else + local remote_opts="--username= --config-dir= --no-auth-cache" + local fc_opts=" + --follow-parent --authors-file= --repack= + --no-metadata --use-svm-props --use-svnsync-props + --log-window-size= --no-checkout --quiet + --repack-flags --use-log-author --localtime + --ignore-paths= --include-paths= $remote_opts + " + local init_opts=" + --template= --shared= --trunk= --tags= + --branches= --stdlayout --minimize-url + --no-metadata --use-svm-props --use-svnsync-props + --rewrite-root= --prefix= --use-log-author + --add-author-from $remote_opts + " + local cmt_opts=" + --edit --rmdir --find-copies-harder --copy-similarity= + " + + case "$subcommand,$cur" in + fetch,--*) + __gitcomp "--revision= --fetch-all $fc_opts" + ;; + clone,--*) + __gitcomp "--revision= $fc_opts $init_opts" + ;; + init,--*) + __gitcomp "$init_opts" + ;; + dcommit,--*) + __gitcomp " + --merge --strategy= --verbose --dry-run + --fetch-all --no-rebase --commit-url + --revision --interactive $cmt_opts $fc_opts + " + ;; + set-tree,--*) + __gitcomp "--stdin $cmt_opts $fc_opts" + ;; + create-ignore,--*|propget,--*|proplist,--*|show-ignore,--*|\ + show-externals,--*|mkdirs,--*) + __gitcomp "--revision=" + ;; + log,--*) + __gitcomp " + --limit= --revision= --verbose --incremental + --oneline --show-commit --non-recursive + --authors-file= --color + " + ;; + rebase,--*) + __gitcomp " + --merge --verbose --strategy= --local + --fetch-all --dry-run $fc_opts + " + ;; + commit-diff,--*) + __gitcomp "--message= --file= --revision= $cmt_opts" + ;; + info,--*) + __gitcomp "--url" + ;; + branch,--*) + __gitcomp "--dry-run --message --tag" + ;; + tag,--*) + __gitcomp "--dry-run --message" + ;; + blame,--*) + __gitcomp "--git-format" + ;; + migrate,--*) + __gitcomp " + --config-dir= --ignore-paths= --minimize + --no-auth-cache --username= + " + ;; + reset,--*) + __gitcomp "--revision= --parent" + ;; + *) + ;; + esac + fi +} + +_git_tag () +{ + local i c=1 f=0 + while [ $c -lt $cword ]; do + i="${words[c]}" + case "$i" in + -d|-v) + __gitcomp_nl "$(__git_tags)" + return + ;; + -f) + f=1 + ;; + esac + ((c++)) + done + + case "$prev" in + -m|-F) + ;; + -*|tag) + if [ $f = 1 ]; then + __gitcomp_nl "$(__git_tags)" + fi + ;; + *) + __gitcomp_nl "$(__git_refs)" + ;; + esac +} + +_git_whatchanged () +{ + _git_log +} + +__git_main () +{ + local i c=1 command __git_dir + + while [ $c -lt $cword ]; do + i="${words[c]}" + case "$i" in + --git-dir=*) __git_dir="${i#--git-dir=}" ;; + --git-dir) ((c++)) ; __git_dir="${words[c]}" ;; + --bare) __git_dir="." ;; + --help) command="help"; break ;; + -c|--work-tree|--namespace) ((c++)) ;; + -*) ;; + *) command="$i"; break ;; + esac + ((c++)) + done + + if [ -z "$command" ]; then + case "$cur" in + --*) __gitcomp " + --paginate + --no-pager + --git-dir= + --bare + --version + --exec-path + --exec-path= + --html-path + --man-path + --info-path + --work-tree= + --namespace= + --no-replace-objects + --help + " + ;; + *) __git_compute_porcelain_commands + __gitcomp "$__git_porcelain_commands $(__git_aliases)" ;; + esac + return + fi + + local completion_func="_git_${command//-/_}" + declare -f $completion_func >/dev/null && $completion_func && return + + local expansion=$(__git_aliased_command "$command") + if [ -n "$expansion" ]; then + completion_func="_git_${expansion//-/_}" + declare -f $completion_func >/dev/null && $completion_func + fi +} + +__gitk_main () +{ + __git_has_doubledash && return + + local g="$(__gitdir)" + local merge="" + if [ -f "$g/MERGE_HEAD" ]; then + merge="--merge" + fi + case "$cur" in + --*) + __gitcomp " + $__git_log_common_options + $__git_log_gitk_options + $merge + " + return + ;; + esac + __git_complete_revlist +} + +if [[ -n ${ZSH_VERSION-} ]]; then + echo "WARNING: this script is deprecated, please see git-completion.zsh" 1>&2 + + autoload -U +X compinit && compinit + + __gitcomp () + { + emulate -L zsh + + local cur_="${3-$cur}" + + case "$cur_" in + --*=) + ;; + *) + local c IFS=$' \t\n' + local -a array + for c in ${=1}; do + c="$c${4-}" + case $c in + --*=*|*.) ;; + *) c="$c " ;; + esac + array[$#array+1]="$c" + done + compset -P '*[=:]' + compadd -Q -S '' -p "${2-}" -a -- array && _ret=0 + ;; + esac + } + + __gitcomp_nl () + { + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0 + } + + __gitcomp_file () + { + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -p "${2-}" -f -- ${=1} && _ret=0 + } + + _git () + { + local _ret=1 cur cword prev + cur=${words[CURRENT]} + prev=${words[CURRENT-1]} + let cword=CURRENT-1 + emulate ksh -c __${service}_main + let _ret && _default && _ret=0 + return _ret + } + + compdef _git git gitk + return +fi + +__git_func_wrap () +{ + local cur words cword prev + _get_comp_words_by_ref -n =: cur words cword prev + $1 +} + +# Setup completion for certain functions defined above by setting common +# variables and workarounds. +# This is NOT a public function; use at your own risk. +__git_complete () +{ + local wrapper="__git_wrap${2}" + eval "$wrapper () { __git_func_wrap $2 ; }" + complete -o bashdefault -o default -o nospace -F $wrapper $1 2>/dev/null \ + || complete -o default -o nospace -F $wrapper $1 +} + +# wrapper for backwards compatibility +_git () +{ + __git_wrap__git_main +} + +# wrapper for backwards compatibility +_gitk () +{ + __git_wrap__gitk_main +} + +__git_complete git __git_main +__git_complete gitk __gitk_main + +# The following are necessary only for Cygwin, and only are needed +# when the user has tab-completed the executable name and consequently +# included the '.exe' suffix. +# +if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then +__git_complete git.exe __git_main +fi diff --git a/.zsh_plugins/gitfast/git-prompt.sh b/.zsh_plugins/gitfast/git-prompt.sh new file mode 100644 index 0000000..a81ef5a --- /dev/null +++ b/.zsh_plugins/gitfast/git-prompt.sh @@ -0,0 +1,445 @@ +# bash/zsh git prompt support +# +# Copyright (C) 2006,2007 Shawn O. Pearce +# Distributed under the GNU General Public License, version 2.0. +# +# This script allows you to see repository status in your prompt. +# +# To enable: +# +# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh). +# 2) Add the following line to your .bashrc/.zshrc: +# source ~/.git-prompt.sh +# 3a) Change your PS1 to call __git_ps1 as +# command-substitution: +# Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ' +# ZSH: setopt PROMPT_SUBST ; PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ ' +# the optional argument will be used as format string. +# 3b) Alternatively, for a slightly faster prompt, __git_ps1 can +# be used for PROMPT_COMMAND in Bash or for precmd() in Zsh +# with two parameters,
 and , which are strings
+#        you would put in $PS1 before and after the status string
+#        generated by the git-prompt machinery.  e.g.
+#        Bash: PROMPT_COMMAND='__git_ps1 "\u@\h:\w" "\\\$ "'
+#          will show username, at-sign, host, colon, cwd, then
+#          various status string, followed by dollar and SP, as
+#          your prompt.
+#        ZSH:  precmd () { __git_ps1 "%n" ":%~$ " "|%s" }
+#          will show username, pipe, then various status string,
+#          followed by colon, cwd, dollar and SP, as your prompt.
+#        Optionally, you can supply a third argument with a printf
+#        format string to finetune the output of the branch status
+#
+# The repository status will be displayed only if you are currently in a
+# git repository. The %s token is the placeholder for the shown status.
+#
+# The prompt status always includes the current branch name.
+#
+# In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty value,
+# unstaged (*) and staged (+) changes will be shown next to the branch
+# name.  You can configure this per-repository with the
+# bash.showDirtyState variable, which defaults to true once
+# GIT_PS1_SHOWDIRTYSTATE is enabled.
+#
+# You can also see if currently something is stashed, by setting
+# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
+# then a '$' will be shown next to the branch name.
+#
+# If you would like to see if there're untracked files, then you can set
+# GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked
+# files, then a '%' will be shown next to the branch name.  You can
+# configure this per-repository with the bash.showUntrackedFiles
+# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is
+# enabled.
+#
+# If you would like to see the difference between HEAD and its upstream,
+# set GIT_PS1_SHOWUPSTREAM="auto".  A "<" indicates you are behind, ">"
+# indicates you are ahead, "<>" indicates you have diverged and "="
+# indicates that there is no difference. You can further control
+# behaviour by setting GIT_PS1_SHOWUPSTREAM to a space-separated list
+# of values:
+#
+#     verbose       show number of commits ahead/behind (+/-) upstream
+#     legacy        don't use the '--count' option available in recent
+#                   versions of git-rev-list
+#     git           always compare HEAD to @{upstream}
+#     svn           always compare HEAD to your SVN upstream
+#
+# By default, __git_ps1 will compare HEAD to your SVN upstream if it can
+# find one, or @{upstream} otherwise.  Once you have set
+# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
+# setting the bash.showUpstream config variable.
+#
+# If you would like to see more information about the identity of
+# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
+# to one of these values:
+#
+#     contains      relative to newer annotated tag (v1.6.3.2~35)
+#     branch        relative to newer tag or branch (master~4)
+#     describe      relative to older annotated tag (v1.6.3.1-13-gdd42c2f)
+#     default       exactly matching tag
+#
+# If you would like a colored hint about the current dirty state, set
+# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
+# the colored output of "git status -sb" and are available only when
+# using __git_ps1 for PROMPT_COMMAND or precmd.
+
+# stores the divergence from upstream in $p
+# used by GIT_PS1_SHOWUPSTREAM
+__git_ps1_show_upstream ()
+{
+	local key value
+	local svn_remote svn_url_pattern count n
+	local upstream=git legacy="" verbose=""
+
+	svn_remote=()
+	# get some config options from git-config
+	local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
+	while read -r key value; do
+		case "$key" in
+		bash.showupstream)
+			GIT_PS1_SHOWUPSTREAM="$value"
+			if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then
+				p=""
+				return
+			fi
+			;;
+		svn-remote.*.url)
+			svn_remote[$((${#svn_remote[@]} + 1))]="$value"
+			svn_url_pattern+="\\|$value"
+			upstream=svn+git # default upstream is SVN if available, else git
+			;;
+		esac
+	done <<< "$output"
+
+	# parse configuration values
+	for option in ${GIT_PS1_SHOWUPSTREAM}; do
+		case "$option" in
+		git|svn) upstream="$option" ;;
+		verbose) verbose=1 ;;
+		legacy)  legacy=1  ;;
+		esac
+	done
+
+	# Find our upstream
+	case "$upstream" in
+	git)    upstream="@{upstream}" ;;
+	svn*)
+		# get the upstream from the "git-svn-id: ..." in a commit message
+		# (git-svn uses essentially the same procedure internally)
+		local -a svn_upstream
+		svn_upstream=($(git log --first-parent -1 \
+					--grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null))
+		if [[ 0 -ne ${#svn_upstream[@]} ]]; then
+			svn_upstream=${svn_upstream[${#svn_upstream[@]} - 2]}
+			svn_upstream=${svn_upstream%@*}
+			local n_stop="${#svn_remote[@]}"
+			for ((n=1; n <= n_stop; n++)); do
+				svn_upstream=${svn_upstream#${svn_remote[$n]}}
+			done
+
+			if [[ -z "$svn_upstream" ]]; then
+				# default branch name for checkouts with no layout:
+				upstream=${GIT_SVN_ID:-git-svn}
+			else
+				upstream=${svn_upstream#/}
+			fi
+		elif [[ "svn+git" = "$upstream" ]]; then
+			upstream="@{upstream}"
+		fi
+		;;
+	esac
+
+	# Find how many commits we are ahead/behind our upstream
+	if [[ -z "$legacy" ]]; then
+		count="$(git rev-list --count --left-right \
+				"$upstream"...HEAD 2>/dev/null)"
+	else
+		# produce equivalent output to --count for older versions of git
+		local commits
+		if commits="$(git rev-list --left-right "$upstream"...HEAD 2>/dev/null)"
+		then
+			local commit behind=0 ahead=0
+			for commit in $commits
+			do
+				case "$commit" in
+				"<"*) ((behind++)) ;;
+				*)    ((ahead++))  ;;
+				esac
+			done
+			count="$behind	$ahead"
+		else
+			count=""
+		fi
+	fi
+
+	# calculate the result
+	if [[ -z "$verbose" ]]; then
+		case "$count" in
+		"") # no upstream
+			p="" ;;
+		"0	0") # equal to upstream
+			p="=" ;;
+		"0	"*) # ahead of upstream
+			p=">" ;;
+		*"	0") # behind upstream
+			p="<" ;;
+		*)	    # diverged from upstream
+			p="<>" ;;
+		esac
+	else
+		case "$count" in
+		"") # no upstream
+			p="" ;;
+		"0	0") # equal to upstream
+			p=" u=" ;;
+		"0	"*) # ahead of upstream
+			p=" u+${count#0	}" ;;
+		*"	0") # behind upstream
+			p=" u-${count%	0}" ;;
+		*)	    # diverged from upstream
+			p=" u+${count#*	}-${count%	*}" ;;
+		esac
+	fi
+
+}
+
+# Helper function that is meant to be called from __git_ps1.  It
+# injects color codes into the appropriate gitstring variables used
+# to build a gitstring.
+__git_ps1_colorize_gitstring ()
+{
+	if [[ -n ${ZSH_VERSION-} ]]; then
+		local c_red='%F{red}'
+		local c_green='%F{green}'
+		local c_lblue='%F{blue}'
+		local c_clear='%f'
+	else
+		# Using \[ and \] around colors is necessary to prevent
+		# issues with command line editing/browsing/completion!
+		local c_red='\[\e[31m\]'
+		local c_green='\[\e[32m\]'
+		local c_lblue='\[\e[1;34m\]'
+		local c_clear='\[\e[0m\]'
+	fi
+	local bad_color=$c_red
+	local ok_color=$c_green
+	local flags_color="$c_lblue"
+
+	local branch_color=""
+	if [ $detached = no ]; then
+		branch_color="$ok_color"
+	else
+		branch_color="$bad_color"
+	fi
+	c="$branch_color$c"
+
+	z="$c_clear$z"
+	if [ "$w" = "*" ]; then
+		w="$bad_color$w"
+	fi
+	if [ -n "$i" ]; then
+		i="$ok_color$i"
+	fi
+	if [ -n "$s" ]; then
+		s="$flags_color$s"
+	fi
+	if [ -n "$u" ]; then
+		u="$bad_color$u"
+	fi
+	r="$c_clear$r"
+}
+
+# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
+# when called from PS1 using command substitution
+# in this mode it prints text to add to bash PS1 prompt (includes branch name)
+#
+# __git_ps1 requires 2 or 3 arguments when called from PROMPT_COMMAND (pc)
+# in that case it _sets_ PS1. The arguments are parts of a PS1 string.
+# when two arguments are given, the first is prepended and the second appended
+# to the state string when assigned to PS1.
+# The optional third parameter will be used as printf format string to further
+# customize the output of the git-status string.
+# In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true
+__git_ps1 ()
+{
+	local pcmode=no
+	local detached=no
+	local ps1pc_start='\u@\h:\w '
+	local ps1pc_end='\$ '
+	local printf_format=' (%s)'
+
+	case "$#" in
+		2|3)	pcmode=yes
+			ps1pc_start="$1"
+			ps1pc_end="$2"
+			printf_format="${3:-$printf_format}"
+		;;
+		0|1)	printf_format="${1:-$printf_format}"
+		;;
+		*)	return
+		;;
+	esac
+
+	local repo_info rev_parse_exit_code
+	repo_info="$(git rev-parse --git-dir --is-inside-git-dir \
+		--is-bare-repository --is-inside-work-tree \
+		--short HEAD 2>/dev/null)"
+	rev_parse_exit_code="$?"
+
+	if [ -z "$repo_info" ]; then
+		if [ $pcmode = yes ]; then
+			#In PC mode PS1 always needs to be set
+			PS1="$ps1pc_start$ps1pc_end"
+		fi
+		return
+	fi
+
+	local short_sha
+	if [ "$rev_parse_exit_code" = "0" ]; then
+		short_sha="${repo_info##*$'\n'}"
+		repo_info="${repo_info%$'\n'*}"
+	fi
+	local inside_worktree="${repo_info##*$'\n'}"
+	repo_info="${repo_info%$'\n'*}"
+	local bare_repo="${repo_info##*$'\n'}"
+	repo_info="${repo_info%$'\n'*}"
+	local inside_gitdir="${repo_info##*$'\n'}"
+	local g="${repo_info%$'\n'*}"
+
+	local r=""
+	local b=""
+	local step=""
+	local total=""
+	if [ -d "$g/rebase-merge" ]; then
+		read b 2>/dev/null <"$g/rebase-merge/head-name"
+		read step 2>/dev/null <"$g/rebase-merge/msgnum"
+		read total 2>/dev/null <"$g/rebase-merge/end"
+		if [ -f "$g/rebase-merge/interactive" ]; then
+			r="|REBASE-i"
+		else
+			r="|REBASE-m"
+		fi
+	else
+		if [ -d "$g/rebase-apply" ]; then
+			read step 2>/dev/null <"$g/rebase-apply/next"
+			read total 2>/dev/null <"$g/rebase-apply/last"
+			if [ -f "$g/rebase-apply/rebasing" ]; then
+				read b 2>/dev/null <"$g/rebase-apply/head-name"
+				r="|REBASE"
+			elif [ -f "$g/rebase-apply/applying" ]; then
+				r="|AM"
+			else
+				r="|AM/REBASE"
+			fi
+		elif [ -f "$g/MERGE_HEAD" ]; then
+			r="|MERGING"
+		elif [ -f "$g/CHERRY_PICK_HEAD" ]; then
+			r="|CHERRY-PICKING"
+		elif [ -f "$g/REVERT_HEAD" ]; then
+			r="|REVERTING"
+		elif [ -f "$g/BISECT_LOG" ]; then
+			r="|BISECTING"
+		fi
+
+		if [ -n "$b" ]; then
+			:
+		elif [ -h "$g/HEAD" ]; then
+			# symlink symbolic ref
+			b="$(git symbolic-ref HEAD 2>/dev/null)"
+		else
+			local head=""
+			if ! read head 2>/dev/null <"$g/HEAD"; then
+				if [ $pcmode = yes ]; then
+					PS1="$ps1pc_start$ps1pc_end"
+				fi
+				return
+			fi
+			# is it a symbolic ref?
+			b="${head#ref: }"
+			if [ "$head" = "$b" ]; then
+				detached=yes
+				b="$(
+				case "${GIT_PS1_DESCRIBE_STYLE-}" in
+				(contains)
+					git describe --contains HEAD ;;
+				(branch)
+					git describe --contains --all HEAD ;;
+				(describe)
+					git describe HEAD ;;
+				(* | default)
+					git describe --tags --exact-match HEAD ;;
+				esac 2>/dev/null)" ||
+
+				b="$short_sha..."
+				b="($b)"
+			fi
+		fi
+	fi
+
+	if [ -n "$step" ] && [ -n "$total" ]; then
+		r="$r $step/$total"
+	fi
+
+	local w=""
+	local i=""
+	local s=""
+	local u=""
+	local c=""
+	local p=""
+
+	if [ "true" = "$inside_gitdir" ]; then
+		if [ "true" = "$bare_repo" ]; then
+			c="BARE:"
+		else
+			b="GIT_DIR!"
+		fi
+	elif [ "true" = "$inside_worktree" ]; then
+		if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] &&
+		   [ "$(git config --bool bash.showDirtyState)" != "false" ]
+		then
+			git diff --no-ext-diff --quiet --exit-code || w="*"
+			if [ -n "$short_sha" ]; then
+				git diff-index --cached --quiet HEAD -- || i="+"
+			else
+				i="#"
+			fi
+		fi
+		if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] &&
+		   [ -r "$g/refs/stash" ]; then
+			s="$"
+		fi
+
+		if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
+		   [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
+		   git ls-files --others --exclude-standard --error-unmatch -- '*' >/dev/null 2>/dev/null
+		then
+			u="%${ZSH_VERSION+%}"
+		fi
+
+		if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then
+			__git_ps1_show_upstream
+		fi
+	fi
+
+	local z="${GIT_PS1_STATESEPARATOR-" "}"
+
+	# NO color option unless in PROMPT_COMMAND mode
+	if [ $pcmode = yes ] && [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
+		__git_ps1_colorize_gitstring
+	fi
+
+	local f="$w$i$s$u"
+	local gitstring="$c${b##refs/heads/}${f:+$z$f}$r$p"
+
+	if [ $pcmode = yes ]; then
+		if [[ -n ${ZSH_VERSION-} ]]; then
+			gitstring=$(printf -- "$printf_format" "$gitstring")
+		else
+			printf -v gitstring -- "$printf_format" "$gitstring"
+		fi
+		PS1="$ps1pc_start$gitstring$ps1pc_end"
+	else
+		printf -- "$printf_format" "$gitstring"
+	fi
+}
diff --git a/.zsh_plugins/gitfast/gitfast.plugin.zsh b/.zsh_plugins/gitfast/gitfast.plugin.zsh
new file mode 100644
index 0000000..dba1b13
--- /dev/null
+++ b/.zsh_plugins/gitfast/gitfast.plugin.zsh
@@ -0,0 +1,8 @@
+dir=$(dirname $0)
+source $dir/../git/git.plugin.zsh
+source $dir/git-prompt.sh
+
+function git_prompt_info() {
+  dirty="$(parse_git_dirty)"
+  __git_ps1 "${ZSH_THEME_GIT_PROMPT_PREFIX//\%/%%}%s${dirty//\%/%%}${ZSH_THEME_GIT_PROMPT_SUFFIX//\%/%%}"
+}
diff --git a/.zsh_plugins/github/_github b/.zsh_plugins/github/_github
new file mode 100644
index 0000000..83e1713
--- /dev/null
+++ b/.zsh_plugins/github/_github
@@ -0,0 +1,40 @@
+#compdef github
+#autoload
+
+# in order to make this work, you will need to have the github gem installed
+# http://github.com/defunkt/github-gem
+
+# github zsh completion, based on homebrew completion
+
+local -a _1st_arguments
+_1st_arguments=(
+  'browse:Open this repo in a web browser'
+  'clone:Clone a repo'
+  'config:Automatically set configuration info, or pass args to specify'
+  'create-from-local:Create a new GitHub repository from the current local repository'
+  'create:Create a new empty GitHub repository'
+  'fetch:Fetch from a remote to a local branch'
+  'fetch_all:Fetch all refs from a user'
+  'fork:Forks a GitHub repository'
+  'home:Open this repos master branch in a web browser'
+  'ignore:Ignore a SHA from github network commits'
+  'info:Info about this project'
+  'issues:Project issues tools'
+  'network:Project network tools - sub-commands : web [user], list, fetch, commits'
+  'open:Open the given user/project in a web browser'
+  'pull-request:Generate the text for a pull request'
+  'pull:Pull from a remote'
+  'search:Search GitHub for the given repository name'
+  'track:Track another users repository'
+)
+
+local expl
+local -a pkgs installed_pkgs
+
+_arguments \
+  '*:: :->subcmds' && return 0
+
+if (( CURRENT == 1 )); then
+  _describe -t commands "github subcommand" _1st_arguments
+  return
+fi
diff --git a/.zsh_plugins/github/github.plugin.zsh b/.zsh_plugins/github/github.plugin.zsh
new file mode 100644
index 0000000..66a10cf
--- /dev/null
+++ b/.zsh_plugins/github/github.plugin.zsh
@@ -0,0 +1,88 @@
+# Setup hub function for git, if it is available; http://github.com/defunkt/hub
+if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then
+    # Autoload _git completion functions
+    if declare -f _git > /dev/null; then
+      _git
+    fi
+    
+    if declare -f _git_commands > /dev/null; then
+        _hub_commands=(
+            'alias:show shell instructions for wrapping git'
+            'pull-request:open a pull request on GitHub'
+            'fork:fork origin repo on GitHub'
+            'create:create new repo on GitHub for the current project'
+            'browse:browse the project on GitHub'
+            'compare:open GitHub compare view'
+        )
+        # Extend the '_git_commands' function with hub commands
+        eval "$(declare -f _git_commands | sed -e 's/base_commands=(/base_commands=(${_hub_commands} /')"
+    fi
+    # eval `hub alias -s zsh`
+    function git(){
+        if ! (( $+_has_working_hub  )); then
+            hub --version &> /dev/null
+            _has_working_hub=$(($? == 0))
+        fi
+        if (( $_has_working_hub )) ; then
+            hub "$@"
+        else
+            command git "$@"
+        fi
+    }
+fi
+
+# Functions #################################################################
+
+# https://github.com/dbb 
+
+
+# empty_gh [NAME_OF_REPO]
+#
+# Use this when creating a new repo from scratch.
+empty_gh() { # [NAME_OF_REPO]
+    repo = $1
+    ghuser=$(  git config github.user )
+
+    mkdir "$repo"
+    cd "$repo"
+    git init
+    touch README
+    git add README
+    git commit -m 'Initial commit.'
+    git remote add origin git@github.com:${ghuser}/${repo}.git
+    git push -u origin master
+}
+
+# new_gh [DIRECTORY]
+#
+# Use this when you have a directory that is not yet set up for git.
+# This function will add all non-hidden files to git.
+new_gh() { # [DIRECTORY]
+    cd "$1"
+    ghuser=$( git config github.user )
+
+    git init
+    # add all non-dot files
+    print '.*'"\n"'*~' >> .gitignore
+    git add ^.*
+    git commit -m 'Initial commit.'
+    git remote add origin git@github.com:${ghuser}/${repo}.git
+    git push -u origin master
+}
+
+# exist_gh [DIRECTORY]
+#
+# Use this when you have a git repo that's ready to go and you want to add it
+# to your GitHub.
+exist_gh() { # [DIRECTORY]
+    cd "$1"
+    name=$( git config user.name )
+    ghuser=$( git config github.user )
+    repo=$1
+
+    git remote add origin git@github.com:${ghuser}/${repo}.git
+    git push -u origin master
+}
+
+# End Functions #############################################################
+
diff --git a/.zsh_plugins/gitignore/gitignore.plugin.zsh b/.zsh_plugins/gitignore/gitignore.plugin.zsh
new file mode 100644
index 0000000..be037d8
--- /dev/null
+++ b/.zsh_plugins/gitignore/gitignore.plugin.zsh
@@ -0,0 +1,12 @@
+function gi() { curl http://www.gitignore.io/api/$@ ;}
+
+_gitignireio_get_command_list() {
+  curl -s http://www.gitignore.io/api/list | tr "," "\n"
+}
+
+_gitignireio () {
+  compset -P '*,'
+  compadd -S '' `_gitignireio_get_command_list`
+}
+
+compdef _gitignireio gi
diff --git a/.zsh_plugins/gnu-utils/gnu-utils.plugin.zsh b/.zsh_plugins/gnu-utils/gnu-utils.plugin.zsh
new file mode 100644
index 0000000..e59265d
--- /dev/null
+++ b/.zsh_plugins/gnu-utils/gnu-utils.plugin.zsh
@@ -0,0 +1,80 @@
+# ------------------------------------------------------------------------------
+#          FILE:  gnu-utils.plugin.zsh
+#   DESCRIPTION:  oh-my-zsh plugin file.
+#        AUTHOR:  Sorin Ionescu (sorin.ionescu@gmail.com)
+#       VERSION:  1.0.0
+# ------------------------------------------------------------------------------
+
+
+if [[ -x "${commands[gwhoami]}" ]]; then 
+  __gnu_utils() {
+    emulate -L zsh
+    local gcmds
+    local gcmd
+    local cmd
+    local prefix
+
+    # coreutils 
+    gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
+    'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
+    'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
+    'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid'
+    'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum'
+    'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc'
+    'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd'
+    'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum'
+    'gsha256sum' 'gsha384sum' 'gsha512sum' 'gshred' 'gshuf' 'gsleep' 'gsort'
+    'gsplit' 'gstat' 'gstty' 'gsum' 'gsync' 'gtac' 'gtail' 'gtee' 'gtest'
+    'gtimeout' 'gtouch' 'gtr' 'gtrue' 'gtruncate' 'gtsort' 'gtty' 'guname'
+    'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
+    'gwhoami' 'gyes')
+
+    # Not part of coreutils, installed separately.
+    gcmds+=('gsed' 'gtar' 'gtime')
+
+    for gcmd in "${gcmds[@]}"; do
+      #
+      # This method allows for builtin commands to be primary but it's
+      # lost if hash -r or rehash -f is executed. Thus, those two 
+      # functions have to be wrapped.
+      #
+      (( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]}
+
+      #
+      # This method generates wrapper functions.
+      # It will override shell builtins.
+      #
+      # (( ${+commands[$gcmd]} )) && \
+      # eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }"
+
+      #
+      # This method is inflexible since the aliases are at risk of being
+      # overriden resulting in the BSD coreutils being called.
+      #
+      # (( ${+commands[$gcmd]} )) && \
+      # alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}"
+    done
+
+    return 0
+  }
+  __gnu_utils;
+
+  function hash() {
+    if [[ "$*" =~ "-(r|f)" ]]; then
+      builtin hash "$@"
+      __gnu_utils
+    else
+      builtin hash "$@"
+    fi
+  }
+
+  function rehash() {
+    if [[ "$*" =~ "-f" ]]; then
+      builtin rehash "$@"
+      __gnu_utils
+    else
+      builtin rehash "$@"
+    fi
+  }
+fi
+
diff --git a/.zsh_plugins/golang/golang.plugin.zsh b/.zsh_plugins/golang/golang.plugin.zsh
new file mode 100644
index 0000000..18bcaaf
--- /dev/null
+++ b/.zsh_plugins/golang/golang.plugin.zsh
@@ -0,0 +1,160 @@
+# install in /etc/zsh/zshrc or your personal .zshrc
+
+# gc
+prefixes=(5 6 8)
+for p in $prefixes; do
+	compctl -g "*.${p}" ${p}l
+	compctl -g "*.go" ${p}g
+done
+
+# standard go tools
+compctl -g "*.go" gofmt
+
+# gccgo
+compctl -g "*.go" gccgo
+
+# go tool
+__go_tool_complete() {
+  typeset -a commands build_flags
+  commands+=(
+    'build[compile packages and dependencies]'
+    'clean[remove object files]'
+    'doc[run godoc on package sources]'
+    'env[print Go environment information]'
+    'fix[run go tool fix on packages]'
+    'fmt[run gofmt on package sources]'
+    'get[download and install packages and dependencies]'
+    'help[display help]'
+    'install[compile and install packages and dependencies]'
+    'list[list packages]'
+    'run[compile and run Go program]'
+    'test[test packages]'
+    'tool[run specified go tool]'
+    'version[print Go version]'
+    'vet[run go tool vet on packages]'
+  )
+  if (( CURRENT == 2 )); then
+    # explain go commands
+    _values 'go tool commands' ${commands[@]}
+    return
+  fi
+  build_flags=(
+    '-a[force reinstallation of packages that are already up-to-date]'
+    '-n[print the commands but do not run them]'
+    '-p[number of parallel builds]:number'
+    '-race[enable data race detection]'
+    '-x[print the commands]'
+    '-work[print temporary directory name and keep it]'
+    '-ccflags[flags for 5c/6c/8c]:flags'
+    '-gcflags[flags for 5g/6g/8g]:flags'
+    '-ldflags[flags for 5l/6l/8l]:flags'
+    '-gccgoflags[flags for gccgo]:flags'
+    '-compiler[name of compiler to use]:name'
+    '-installsuffix[suffix to add to package directory]:suffix'
+    '-tags[list of build tags to consider satisfied]:tags'
+  )
+  __go_list() {
+      local expl importpaths
+      declare -a importpaths
+      importpaths=($(go list ${words[$CURRENT]}... 2>/dev/null))
+      _wanted importpaths expl 'import paths' compadd "$@" - "${importpaths[@]}"
+  }
+  case ${words[2]} in
+  clean|doc)
+      _arguments -s -w : '*:importpaths:__go_list'
+      ;;
+  fix|fmt|list|vet)
+      _alternative ':importpaths:__go_list' ':files:_path_files -g "*.go"'
+      ;;
+  install)
+      _arguments -s -w : ${build_flags[@]} \
+        "-v[show package names]" \
+        '*:importpaths:__go_list'
+      ;;
+  get)
+      _arguments -s -w : \
+        ${build_flags[@]}
+      ;;
+  build)
+      _arguments -s -w : \
+        ${build_flags[@]} \
+        "-v[show package names]" \
+        "-o[output file]:file:_files" \
+        "*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
+      ;;
+  test)
+      _arguments -s -w : \
+        ${build_flags[@]} \
+        "-c[do not run, compile the test binary]" \
+        "-i[do not run, install dependencies]" \
+        "-v[print test output]" \
+        "-x[print the commands]" \
+        "-short[use short mode]" \
+        "-parallel[number of parallel tests]:number" \
+        "-cpu[values of GOMAXPROCS to use]:number list" \
+        "-run[run tests and examples matching regexp]:regexp" \
+        "-bench[run benchmarks matching regexp]:regexp" \
+        "-benchmem[print memory allocation stats]" \
+        "-benchtime[run each benchmark until taking this long]:duration" \
+        "-blockprofile[write goroutine blocking profile to file]:file" \
+        "-blockprofilerate[set sampling rate of goroutine blocking profile]:number" \
+        "-timeout[kill test after that duration]:duration" \
+        "-cpuprofile[write CPU profile to file]:file:_files" \
+        "-memprofile[write heap profile to file]:file:_files" \
+        "-memprofilerate[set heap profiling rate]:number" \
+        "*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
+      ;;
+  help)
+      _values "${commands[@]}" \
+        'gopath[GOPATH environment variable]' \
+        'packages[description of package lists]' \
+        'remote[remote import path syntax]' \
+        'testflag[description of testing flags]' \
+        'testfunc[description of testing functions]'
+      ;;
+  run)
+      _arguments -s -w : \
+          ${build_flags[@]} \
+          '*:file:_path_files -g "*.go"'
+      ;;
+  tool)
+      if (( CURRENT == 3 )); then
+          _values "go tool" $(go tool)
+          return
+      fi
+      case ${words[3]} in
+      [568]g)
+          _arguments -s -w : \
+              '-I[search for packages in DIR]:includes:_path_files -/' \
+              '-L[show full path in file:line prints]' \
+              '-S[print the assembly language]' \
+              '-V[print the compiler version]' \
+              '-e[no limit on number of errors printed]' \
+              '-h[panic on an error]' \
+              '-l[disable inlining]' \
+              '-m[print optimization decisions]' \
+              '-o[file specify output file]:file' \
+              '-p[assumed import path for this code]:importpath' \
+              '-u[disable package unsafe]' \
+              "*:file:_files -g '*.go'"
+          ;;
+      [568]l)
+          local O=${words[3]%l}
+          _arguments -s -w : \
+              '-o[file specify output file]:file' \
+              '-L[search for packages in DIR]:includes:_path_files -/' \
+              "*:file:_files -g '*.[ao$O]'"
+          ;;
+      dist)
+          _values "dist tool" banner bootstrap clean env install version
+          ;;
+      *)
+          # use files by default
+          _files
+          ;;
+      esac
+      ;;
+  esac
+}
+
+compdef __go_tool_complete go
diff --git a/.zsh_plugins/gpg-agent/gpg-agent.plugin.zsh b/.zsh_plugins/gpg-agent/gpg-agent.plugin.zsh
new file mode 100644
index 0000000..3e6a34f
--- /dev/null
+++ b/.zsh_plugins/gpg-agent/gpg-agent.plugin.zsh
@@ -0,0 +1,41 @@
+local GPG_ENV=$HOME/.gnupg/gpg-agent.env
+
+function start_agent_nossh {
+    eval $(/usr/bin/env gpg-agent --quiet --daemon --write-env-file ${GPG_ENV} 2> /dev/null)
+    chmod 600 ${GPG_ENV}
+    export GPG_AGENT_INFO
+}
+
+function start_agent_withssh {
+    eval $(/usr/bin/env gpg-agent --quiet --daemon --enable-ssh-support --write-env-file ${GPG_ENV} 2> /dev/null)
+    chmod 600 ${GPG_ENV}
+    export GPG_AGENT_INFO
+    export SSH_AUTH_SOCK
+    export SSH_AGENT_PID
+}
+
+# check if another agent is running
+if ! gpg-connect-agent --quiet /bye > /dev/null 2> /dev/null; then
+    # source settings of old agent, if applicable
+    if [ -f "${GPG_ENV}" ]; then
+        . ${GPG_ENV} > /dev/null
+        export GPG_AGENT_INFO
+        export SSH_AUTH_SOCK
+        export SSH_AGENT_PID
+    fi
+
+    # check again if another agent is running using the newly sourced settings
+    if ! gpg-connect-agent --quiet /bye > /dev/null 2> /dev/null; then
+        # check for existing ssh-agent
+        if ssh-add -l > /dev/null 2> /dev/null; then
+            # ssh-agent running, start gpg-agent without ssh support
+            start_agent_nossh;
+        else
+            # otherwise start gpg-agent with ssh support
+            start_agent_withssh;
+        fi
+    fi
+fi
+
+GPG_TTY=$(tty)
+export GPG_TTY
diff --git a/.zsh_plugins/gradle/gradle.plugin.zsh b/.zsh_plugins/gradle/gradle.plugin.zsh
new file mode 100644
index 0000000..9229512
--- /dev/null
+++ b/.zsh_plugins/gradle/gradle.plugin.zsh
@@ -0,0 +1,106 @@
+#!zsh
+##############################################################################
+# A descriptive listing of core Gradle commands 
+############################################################################
+function _gradle_core_commands() {
+    local ret=1 state
+    _arguments ':subcommand:->subcommand' && ret=0
+
+    case $state in
+      subcommand)
+        subcommands=(
+          "properties:Display all project properties"
+          "tasks:Calculate and display all tasks"
+          "dependencies:Calculate and display all dependencies"
+          "projects:Discover and display all sub-projects"
+          "build:Build the project"
+          "help:Display help"
+        )
+        _describe -t subcommands 'gradle subcommands' subcommands && ret=0
+    esac
+
+    return ret
+}
+
+function _gradle_arguments() {
+    _arguments -C \
+    '-a[Do not rebuild project dependencies]' \
+    '-h[Help]' \
+    '-D[System property]' \
+    '-d[Log at the debug level]' \
+    '--gui[Launches the Gradle GUI app]' \
+    '--stop[Stop the Gradle daemon]' \
+    '--daemon[Use the Gradle daemon]' \
+    '--no-daemon[Do not use the Gradle daemon]' \
+    '--no-opt[Do not perform any task optimization]' \
+    '-i[Log at the info level]' \
+    '-m[Dry run]' \
+    '-P[Set a project property]' \
+    '--profile[Profile the build time]' \
+    '-q[Log at the quiet level (only show errors)]' \
+    '-v[Print the Gradle version info]' \
+    '-x[Specify a task to be excluded]' \
+    '*::command:->command' \
+    && return 0
+}
+
+
+##############################################################################
+# Are we in a directory containing a build.gradle file?
+############################################################################
+function in_gradle() {
+    if [[ -f build.gradle ]]; then
+        echo 1
+    fi
+}
+
+############################################################################## Examine the build.gradle file to see if its
+# timestamp has changed, and if so, regen
+# the .gradle_tasks cache file
+############################################################################
+_gradle_does_task_list_need_generating () {
+  [ ! -f .gradletasknamecache ] && return 0;
+  [ .gradletasknamecache -nt build.gradle ] && return 0;
+  return 1;
+}
+
+
+##############################################################################
+# Discover the gradle tasks by running "gradle tasks --all"
+############################################################################
+_gradle_tasks () {
+  if [ in_gradle ]; then
+    _gradle_arguments
+    if _gradle_does_task_list_need_generating; then
+     gradle tasks --all | grep "^[ ]*[a-zA-Z0-9]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
+    fi
+    compadd -X "==== Gradle Tasks ====" `cat .gradletasknamecache`
+  fi
+}
+
+_gradlew_tasks () {
+  if [ in_gradle ]; then
+    _gradle_arguments
+    if _gradle_does_task_list_need_generating; then
+     gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
+    fi
+    compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache`
+  fi
+}
+
+
+##############################################################################
+# Register the completions against the gradle and gradlew commands
+############################################################################
+compdef _gradle_tasks gradle
+compdef _gradlew_tasks gradlew
+
+
+##############################################################################
+# Open questions for future improvements:
+# 1) Should 'gradle tasks' use --all or just the regular set?
+# 2) Should gradlew use the same approach as gradle?
+# 3) Should only the " - " be replaced with a colon so it can work
+#     with the richer descriptive method of _arguments?
+#     gradle tasks | grep "^[a-zA-Z0-9]*\ -\ " | sed "s/ - /\:/"
+#############################################################################
diff --git a/.zsh_plugins/grails/grails.plugin.zsh b/.zsh_plugins/grails/grails.plugin.zsh
new file mode 100644
index 0000000..1177773
--- /dev/null
+++ b/.zsh_plugins/grails/grails.plugin.zsh
@@ -0,0 +1,60 @@
+_enumerateGrailsScripts() {
+    # Default directoryies
+    directories=($GRAILS_HOME/scripts ~/.grails/scripts ./scripts)
+
+    # Check all of the plugins directories, if they exist
+    if [ -d plugins ]
+    then
+        directories+=(plugins/*/scripts)
+    fi
+    
+    # Enumerate all of the Groovy files
+    files=()
+    for dir in $directories;
+    do
+        if [ -d $dir ]
+        then
+            files+=($dir/[^_]*.groovy)
+        fi
+    done
+    
+    # Don't try to basename ()
+    if [ ${#files} -eq 0 ];
+    then
+        return
+    fi
+    
+    scripts=()
+    for file in $files
+    do
+        # - Strip the path
+        # - Remove all scripts with a leading '_'
+        # - PackagePlugin_.groovy -> PackagePlugin
+        # - PackagePlugin         -> Package-Plugin
+        # - Package-Plugin        -> package-plugin
+        command=$(basename $file                              \
+            | sed -E  -e 's/^_?([^_]+)_?.groovy/\1/'\
+                      -e 's/([a-z])([A-Z])/\1-\2/g' \
+            | tr "[:upper:]" "[:lower:]"            \
+            | sort                                  \
+            | uniq)
+        scripts+=($command)
+    done
+    echo $scripts
+}
+ 
+_grails() {
+    if (( CURRENT == 2 )); then
+        scripts=( $(_enumerateGrailsScripts) )
+        
+        if [ ${#scripts} -ne 0 ];
+        then
+            _multi_parts / scripts
+            return
+        fi
+    fi
+    
+    _files
+}
+ 
+compdef _grails grails
diff --git a/.zsh_plugins/heroku/_heroku b/.zsh_plugins/heroku/_heroku
new file mode 100644
index 0000000..4666330
--- /dev/null
+++ b/.zsh_plugins/heroku/_heroku
@@ -0,0 +1,161 @@
+#compdef heroku
+
+# Heroku Autocomplete plugin for Oh-My-Zsh
+# Requires: The Heroku client gem (https://github.com/heroku/heroku)
+# Author: Ali B. (http://awhitebox.com)
+
+local -a _1st_arguments
+_1st_arguments=(
+  "account\:confirm_billing":"Confirm that your account can be billed at the end of the month"
+  "addons":"list installed addons"
+  "addons\:list":"list all available addons"
+  "addons\:add":"install an addon"
+  "addons\:upgrade":"upgrade an existing addon"
+  "addons\:downgrade":"downgrade an existing addon"
+  "addons\:remove":"uninstall an addon"
+  "addons\:open":"open an addon's dashboard in your browser"
+  "apps":"list your apps"
+  "apps\:info":"show detailed app information"
+  "apps\:create":"create a new app"
+  "apps\:rename":"rename the app"
+  "apps\:open":"open the app in a web browser"
+  "apps\:destroy":"permanently destroy an app"
+  "auth\:login":"log in with your heroku credentials"
+  "auth\:logout":"clear local authentication credentials"
+  "config":"display the config vars for an app"
+  "config\:pull":"pull heroku config vars down to the local environment"
+  "config\:push":"push local config vars to heroku"
+  "config\:set":"set one or more config vars"
+  "config\:unset":"unset one or more config vars"
+  "db\:push":"push local data up to your app"
+  "db\:pull":"pull heroku data down into your local database"
+  "domains":"list custom domains for an app"
+  "domains\:add":"add a custom domain to an app"
+  "domains\:remove":"remove a custom domain from an app"
+  "domains\:clear":"remove all custom domains from an app"
+  "help":"list available commands or display help for a specific command"
+  "keys":"display keys for the current user"
+  "keys\:add":"add a key for the current user"
+  "keys\:remove":"remove a key from the current user"
+  "keys\:clear":"remove all authentication keys from the current user"
+  "logs":"display recent log output"
+  "logs\:cron":"DEPRECATED: display cron logs from legacy logging"
+  "logs\:drains":"manage syslog drains"
+  "maintenance\:on":"put the app into maintenance mode"
+  "maintenance\:off":"take the app out of maintenance mode"
+  "pg\:info":"display database information"
+  "pg\:ingress":"allow direct connections to the database from this IP for one minute"
+  "pg\:promote":"sets DATABASE as your DATABASE_URL"
+  "pg\:psql":"open a psql shell to the database"
+  "pg\:reset":"delete all data in DATABASE"
+  "pg\:unfollow":"stop a replica from following and make it a read/write database"
+  "pg\:wait":"monitor database creation, exit when complete"
+  "pgbackups":"list captured backups"
+  "pgbackups\:url":"get a temporary URL for a backup"
+  "pgbackups\:capture":"capture a backup from a database id"
+  "pgbackups\:restore":"restore a backup to a database"
+  "pgbackups\:destroy":"destroys a backup"
+  "plugins":"list installed plugins"
+  "plugins\:install":"install a plugin"
+  "plugins\:uninstall":"uninstall a plugin"
+  "ps\:dynos":"scale to QTY web processes"
+  "ps\:workers":"scale to QTY background processes"
+  "ps":"list processes for an app"
+  "ps\:restart":"restart an app process"
+  "ps\:scale":"scale processes by the given amount"
+  "releases":"list releases"
+  "releases\:info":"view detailed information for a release"
+  "rollback":"roll back to an older release"
+  "run":"run an attached process"
+  "run\:rake":"remotely execute a rake command"
+  "run\:console":"open a remote console session"
+  "sharing":"list collaborators on an app"
+  "sharing\:add":"add a collaborator to an app"
+  "sharing\:remove":"remove a collaborator from an app"
+  "sharing\:transfer":"transfer an app to a new owner"
+  "ssl":"list certificates for an app"
+  "ssl\:add":"add an ssl certificate to an app"
+  "ssl\:remove":"remove an ssl certificate from an app"
+  "ssl\:clear":"remove all ssl certificates from an app"
+  "stack":"show the list of available stacks"
+  "stack\:migrate":"prepare migration of this app to a new stack"
+  "version":"show heroku client version"
+)
+
+_arguments '*:: :->command'
+
+if (( CURRENT == 1 )); then
+  _describe -t commands "heroku command" _1st_arguments
+  return
+fi
+
+local -a _command_args
+case "$words[1]" in
+  apps:info)
+    _command_args=(
+      '(-r|--raw)'{-r,--raw}'[output info as raw key/value pairs]' \
+    )
+    ;;
+  apps:create)
+    _command_args=(
+      '(-a|--addons)'{-a,--addons}'[a list of addons to install]' \
+      '(-r|--remote)'{-r,--remote}'[the git remote to create, default "heroku"]' \
+      '(-s|--stack)'{-s,--stack}'[the stack on which to create the app]' \
+    )
+    ;;
+  config)
+    _command_args=(
+      '(-s|--shell)'{-s,--shell}'[output config vars in shell format]' \
+    )
+    ;;
+  db:push)
+    _command_args=(
+      '(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \
+      '(-d|--debug)'{-d,--debug}'[enable debugging output]' \
+      '(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the push]' \
+      '(-f|--filter)'{-f,--filter}'[only push certain tables]' \
+      '(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \
+      '(-t|--tables)'{-t,--tables}'[only push the specified tables]' \
+    )
+    ;;
+  db:pull)
+    _command_args=(
+      '(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \
+      '(-d|--debug)'{-d,--debug}'[enable debugging output]' \
+      '(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the pull]' \
+      '(-f|--filter)'{-f,--filter}'[only pull certain tables]' \
+      '(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \
+      '(-t|--tables)'{-t,--tables}'[only pull the specified tables]' \
+    )
+    ;;
+  keys)
+    _command_args=(
+      '(-l|--long)'{-l,--long}'[display extended information for each key]' \
+    )
+    ;;
+  logs)
+    _command_args=(
+      '(-n|--num)'{-n,--num}'[the number of lines to display]' \
+      '(-p|--ps)'{-p,--ps}'[only display logs from the given process]' \
+      '(-s|--source)'{-s,--source}'[only display logs from the given source]' \
+      '(-t|--tail)'{-t,--tail}'[continually stream logs]' \
+    )
+    ;;
+  pgbackups:capture)
+    _command_args=(
+      '(-e|--expire)'{-e,--expire}'[if no slots are available to capture, delete the oldest backup to make room]' \
+    )
+    ;;
+  stack)
+    _command_args=(
+      '(-a|--all)'{-a,--all}'[include deprecated stacks]' \
+    )
+    ;;
+  esac
+
+_arguments \
+  $_command_args \
+  '(--app)--app[the app name]' \
+  '(--remote)--remote[the remote name]' \
+  &&  return 0
+
diff --git a/.zsh_plugins/history-substring-search/README b/.zsh_plugins/history-substring-search/README
new file mode 100644
index 0000000..be11adf
--- /dev/null
+++ b/.zsh_plugins/history-substring-search/README
@@ -0,0 +1,7 @@
+To activate this script, load it into an interactive ZSH session:
+
+  % source history-substring-search.zsh
+
+See the "history-substring-search.zsh" file for more information:
+
+  % sed -n '2,/^$/s/^#//p' history-substring-search.zsh | more
diff --git a/.zsh_plugins/history-substring-search/history-substring-search.plugin.zsh b/.zsh_plugins/history-substring-search/history-substring-search.plugin.zsh
new file mode 100644
index 0000000..99a5922
--- /dev/null
+++ b/.zsh_plugins/history-substring-search/history-substring-search.plugin.zsh
@@ -0,0 +1,12 @@
+# This file integrates the history-substring-search script into oh-my-zsh.
+
+source "$ZSH/plugins/history-substring-search/history-substring-search.zsh"
+
+if test "$CASE_SENSITIVE" = true; then
+  unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS
+fi
+
+if test "$DISABLE_COLOR" = true; then
+  unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+  unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
+fi
diff --git a/.zsh_plugins/history-substring-search/history-substring-search.zsh b/.zsh_plugins/history-substring-search/history-substring-search.zsh
new file mode 100644
index 0000000..53f707c
--- /dev/null
+++ b/.zsh_plugins/history-substring-search/history-substring-search.zsh
@@ -0,0 +1,642 @@
+#!/usr/bin/env zsh
+#
+# This is a clean-room implementation of the Fish[1] shell's history search
+# feature, where you can type in any part of any previously entered command
+# and press the UP and DOWN arrow keys to cycle through the matching commands.
+#
+#-----------------------------------------------------------------------------
+# Usage
+#-----------------------------------------------------------------------------
+#
+# 1. Load this script into your interactive ZSH session:
+#
+#       % source history-substring-search.zsh
+#
+#    If you want to use the zsh-syntax-highlighting[6] script along with this
+#    script, then make sure that you load it *before* you load this script:
+#
+#       % source zsh-syntax-highlighting.zsh
+#       % source history-substring-search.zsh
+#
+# 2. Type any part of any previous command and then:
+#
+#     * Press the UP arrow key to select the nearest command that (1) contains
+#       your query and (2) is older than the current command in the command
+#       history.
+#
+#     * Press the DOWN arrow key to select the nearest command that (1)
+#       contains your query and (2) is newer than the current command in the
+#       command history.
+#
+#     * Press ^U (the Control and U keys simultaneously) to abort the search.
+#
+# 3. If a matching command spans more than one line of text, press the LEFT
+#    arrow key to move the cursor away from the end of the command, and then:
+#
+#     * Press the UP arrow key to move the cursor to the line above.  When the
+#       cursor reaches the first line of the command, pressing the UP arrow
+#       key again will cause this script to perform another search.
+#
+#     * Press the DOWN arrow key to move the cursor to the line below.  When
+#       the cursor reaches the last line of the command, pressing the DOWN
+#       arrow key again will cause this script to perform another search.
+#
+#-----------------------------------------------------------------------------
+# Configuration
+#-----------------------------------------------------------------------------
+#
+# This script defines the following global variables. You may override their
+# default values only after having loaded this script into your ZSH session.
+#
+# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND is a global variable that defines
+#   how the query should be highlighted inside a matching command. Its default
+#   value causes this script to highlight using bold, white text on a magenta
+#   background. See the "Character Highlighting" section in the zshzle(1) man
+#   page to learn about the kinds of values you may assign to this variable.
+#
+# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND is a global variable that
+#   defines how the query should be highlighted when no commands in the
+#   history match it. Its default value causes this script to highlight using
+#   bold, white text on a red background. See the "Character Highlighting"
+#   section in the zshzle(1) man page to learn about the kinds of values you
+#   may assign to this variable.
+#
+# * HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS is a global variable that defines
+#   how the command history will be searched for your query. Its default value
+#   causes this script to perform a case-insensitive search. See the "Globbing
+#   Flags" section in the zshexpn(1) man page to learn about the kinds of
+#   values you may assign to this variable.
+#
+#-----------------------------------------------------------------------------
+# History
+#-----------------------------------------------------------------------------
+#
+# This script was originally written by Peter Stephenson[2], who published it
+# to the ZSH users mailing list (thereby making it public domain) in September
+# 2009. It was later revised by Guido van Steen and released under the BSD
+# license (see below) as part of the fizsh[3] project in January 2011.
+#
+# It was later extracted from fizsh[3] release 1.0.1, refactored heavily, and
+# repackaged as both an oh-my-zsh plugin[4] and as an independently loadable
+# ZSH script[5] by Suraj N. Kurapati in 2011.
+#
+# It was further developed[4] by Guido van Steen, Suraj N. Kurapati, Sorin
+# Ionescu, and Vincent Guerci in 2011.
+#
+# [1]: http://fishshell.com
+# [2]: http://www.zsh.org/mla/users/2009/msg00818.html
+# [3]: http://sourceforge.net/projects/fizsh/
+# [4]: https://github.com/robbyrussell/oh-my-zsh/pull/215
+# [5]: https://github.com/sunaku/zsh-history-substring-search
+# [6]: https://github.com/nicoulaj/zsh-syntax-highlighting
+#
+##############################################################################
+#
+# Copyright (c) 2009 Peter Stephenson
+# Copyright (c) 2011 Guido van Steen
+# Copyright (c) 2011 Suraj N. Kurapati
+# Copyright (c) 2011 Sorin Ionescu
+# Copyright (c) 2011 Vincent Guerci
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+#  * Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+#
+#  * Redistributions in binary form must reproduce the above
+#    copyright notice, this list of conditions and the following
+#    disclaimer in the documentation and/or other materials provided
+#    with the distribution.
+#
+#  * Neither the name of the FIZSH nor the names of its contributors
+#    may be used to endorse or promote products derived from this
+#    software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# configuration variables
+#-----------------------------------------------------------------------------
+
+HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
+HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
+HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
+
+#-----------------------------------------------------------------------------
+# the main ZLE widgets
+#-----------------------------------------------------------------------------
+
+function history-substring-search-up() {
+  _history-substring-search-begin
+
+  _history-substring-search-up-history ||
+  _history-substring-search-up-buffer ||
+  _history-substring-search-up-search
+
+  _history-substring-search-end
+}
+
+function history-substring-search-down() {
+  _history-substring-search-begin
+
+  _history-substring-search-down-history ||
+  _history-substring-search-down-buffer ||
+  _history-substring-search-down-search
+
+  _history-substring-search-end
+}
+
+zle -N history-substring-search-up
+zle -N history-substring-search-down
+
+bindkey '\e[A' history-substring-search-up
+bindkey '\e[B' history-substring-search-down
+
+#-----------------------------------------------------------------------------
+# implementation details
+#-----------------------------------------------------------------------------
+
+setopt extendedglob
+zmodload -F zsh/parameter
+
+#
+# We have to "override" some keys and widgets if the
+# zsh-syntax-highlighting plugin has not been loaded:
+#
+# https://github.com/nicoulaj/zsh-syntax-highlighting
+#
+if [[ $+functions[_zsh_highlight] -eq 0 ]]; then
+  #
+  # Dummy implementation of _zsh_highlight()
+  # that simply removes existing highlights
+  #
+  function _zsh_highlight() {
+    region_highlight=()
+  }
+
+  #
+  # Remove existing highlights when the user
+  # inserts printable characters into $BUFFER
+  #
+  function ordinary-key-press() {
+    if [[ $KEYS == [[:print:]] ]]; then
+      region_highlight=()
+    fi
+    zle .self-insert
+  }
+  zle -N self-insert ordinary-key-press
+
+  #
+  # Override ZLE widgets to invoke _zsh_highlight()
+  #
+  # https://github.com/nicoulaj/zsh-syntax-highlighting/blob/
+  # bb7fcb79fad797a40077bebaf6f4e4a93c9d8163/zsh-syntax-highlighting.zsh#L121
+  #
+  #--------------8<-------------------8<-------------------8<-----------------
+  #
+  # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors
+  # All rights reserved.
+  #
+  # Redistribution and use in source and binary forms, with or without
+  # modification, are permitted provided that the following conditions are
+  # met:
+  #
+  #  * Redistributions of source code must retain the above copyright
+  #    notice, this list of conditions and the following disclaimer.
+  #
+  #  * Redistributions in binary form must reproduce the above copyright
+  #    notice, this list of conditions and the following disclaimer in the
+  #    documentation and/or other materials provided with the distribution.
+  #
+  #  * Neither the name of the zsh-syntax-highlighting contributors nor the
+  #    names of its contributors may be used to endorse or promote products
+  #    derived from this software without specific prior written permission.
+  #
+  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+  # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+  # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+  # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+  # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+  # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+  # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+  # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+  # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+  # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+  # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  # Load ZSH module zsh/zleparameter, needed to override user defined widgets.
+  zmodload zsh/zleparameter 2>/dev/null || {
+    echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter, exiting.' >&2
+    return -1
+  }
+
+  # Override ZLE widgets to make them invoke _zsh_highlight.
+  for event in ${${(f)"$(zle -la)"}:#(_*|orig-*|.run-help|.which-command)}; do
+    if [[ "$widgets[$event]" == completion:* ]]; then
+      eval "zle -C orig-$event ${${${widgets[$event]}#*:}/:/ } ; $event() { builtin zle orig-$event && _zsh_highlight } ; zle -N $event"
+    else
+      case $event in
+        accept-and-menu-complete)
+          eval "$event() { builtin zle .$event && _zsh_highlight } ; zle -N $event"
+          ;;
+
+        # The following widgets should NOT remove any previously
+        # applied highlighting. Therefore we do not remap them.
+        .forward-char|.backward-char|.up-line-or-history|.down-line-or-history)
+          ;;
+
+        .*)
+          clean_event=$event[2,${#event}] # Remove the leading dot in the event name
+          case ${widgets[$clean_event]-} in
+            (completion|user):*)
+              ;;
+            *)
+              eval "$clean_event() { builtin zle $event && _zsh_highlight } ; zle -N $clean_event"
+              ;;
+          esac
+          ;;
+        *)
+          ;;
+      esac
+    fi
+  done
+  unset event clean_event
+  #-------------->8------------------->8------------------->8-----------------
+fi
+
+function _history-substring-search-begin() {
+  _history_substring_search_move_cursor_eol=false
+  _history_substring_search_query_highlight=
+
+  #
+  # Continue using the previous $_history_substring_search_result by default,
+  # unless the current query was cleared or a new/different query was entered.
+  #
+  if [[ -z $BUFFER || $BUFFER != $_history_substring_search_result ]]; then
+    #
+    # For the purpose of highlighting we will also keep
+    # a version without doubly-escaped meta characters.
+    #
+    _history_substring_search_query=$BUFFER
+
+    #
+    # $BUFFER contains the text that is in the command-line currently.
+    # we put an extra "\\" before meta characters such as "\(" and "\)",
+    # so that they become "\\\(" and "\\\)".
+    #
+    _history_substring_search_query_escaped=${BUFFER//(#m)[\][()|\\*?#<>~^]/\\$MATCH}
+
+    #
+    # Find all occurrences of the search query in the history file.
+    #
+    # (k) turns it an array of line numbers.
+    #
+    # (on) seems to remove duplicates, which are default
+    #      options. They can be turned off by (ON).
+    #
+    _history_substring_search_matches=(${(kon)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)*${_history_substring_search_query_escaped}*]})
+
+    #
+    # Define the range of values that $_history_substring_search_match_index
+    # can take: [0, $_history_substring_search_matches_count_plus].
+    #
+    _history_substring_search_matches_count=$#_history_substring_search_matches
+    _history_substring_search_matches_count_plus=$(( _history_substring_search_matches_count + 1 ))
+    _history_substring_search_matches_count_sans=$(( _history_substring_search_matches_count - 1 ))
+
+    #
+    # If $_history_substring_search_match_index is equal to
+    # $_history_substring_search_matches_count_plus, this indicates that we
+    # are beyond the beginning of $_history_substring_search_matches.
+    #
+    # If $_history_substring_search_match_index is equal to 0, this indicates
+    # that we are beyond the end of $_history_substring_search_matches.
+    #
+    # If we have initially pressed "up" we have to initialize
+    # $_history_substring_search_match_index to
+    # $_history_substring_search_matches_count_plus so that it will be
+    # decreased to $_history_substring_search_matches_count.
+    #
+    # If we have initially pressed "down" we have to initialize
+    # $_history_substring_search_match_index to
+    # $_history_substring_search_matches_count so that it will be increased to
+    # $_history_substring_search_matches_count_plus.
+    #
+    if [[ $WIDGET == history-substring-search-down ]]; then
+       _history_substring_search_match_index=$_history_substring_search_matches_count
+    else
+      _history_substring_search_match_index=$_history_substring_search_matches_count_plus
+    fi
+  fi
+}
+
+function _history-substring-search-end() {
+  _history_substring_search_result=$BUFFER
+
+  # move the cursor to the end of the command line
+  if [[ $_history_substring_search_move_cursor_eol == true ]]; then
+    CURSOR=${#BUFFER}
+  fi
+
+  # highlight command line using zsh-syntax-highlighting
+  _zsh_highlight
+
+  # highlight the search query inside the command line
+  if [[ -n $_history_substring_search_query_highlight && -n $_history_substring_search_query ]]; then
+    #
+    # The following expression yields a variable $MBEGIN, which
+    # indicates the begin position + 1 of the first occurrence
+    # of _history_substring_search_query_escaped in $BUFFER.
+    #
+    : ${(S)BUFFER##(#m$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)($_history_substring_search_query##)}
+    local begin=$(( MBEGIN - 1 ))
+    local end=$(( begin + $#_history_substring_search_query ))
+    region_highlight+=("$begin $end $_history_substring_search_query_highlight")
+  fi
+
+  # For debugging purposes:
+  # zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches}
+  # read -k -t 200 && zle -U $REPLY
+
+  # Exit successfully from the history-substring-search-* widgets.
+  true
+}
+
+function _history-substring-search-up-buffer() {
+  #
+  # Check if the UP arrow was pressed to move the cursor within a multi-line
+  # buffer. This amounts to three tests:
+  #
+  # 1. $#buflines -gt 1.
+  #
+  # 2. $CURSOR -ne $#BUFFER.
+  #
+  # 3. Check if we are on the first line of the current multi-line buffer.
+  #    If so, pressing UP would amount to leaving the multi-line buffer.
+  #
+  #    We check this by adding an extra "x" to $LBUFFER, which makes
+  #    sure that xlbuflines is always equal to the number of lines
+  #    until $CURSOR (including the line with the cursor on it).
+  #
+  local buflines XLBUFFER xlbuflines
+  buflines=(${(f)BUFFER})
+  XLBUFFER=$LBUFFER"x"
+  xlbuflines=(${(f)XLBUFFER})
+
+  if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xlbuflines -ne 1 ]]; then
+    zle up-line-or-history
+    return true
+  fi
+
+  false
+}
+
+function _history-substring-search-down-buffer() {
+  #
+  # Check if the DOWN arrow was pressed to move the cursor within a multi-line
+  # buffer. This amounts to three tests:
+  #
+  # 1. $#buflines -gt 1.
+  #
+  # 2. $CURSOR -ne $#BUFFER.
+  #
+  # 3. Check if we are on the last line of the current multi-line buffer.
+  #    If so, pressing DOWN would amount to leaving the multi-line buffer.
+  #
+  #    We check this by adding an extra "x" to $RBUFFER, which makes
+  #    sure that xrbuflines is always equal to the number of lines
+  #    from $CURSOR (including the line with the cursor on it).
+  #
+  local buflines XRBUFFER xrbuflines
+  buflines=(${(f)BUFFER})
+  XRBUFFER="x"$RBUFFER
+  xrbuflines=(${(f)XRBUFFER})
+
+  if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xrbuflines -ne 1 ]]; then
+    zle down-line-or-history
+    return true
+  fi
+
+  false
+}
+
+function _history-substring-search-up-history() {
+  #
+  # Behave like up in ZSH, except clear the $BUFFER
+  # when beginning of history is reached like in Fish.
+  #
+  if [[ -z $_history_substring_search_query ]]; then
+
+    # we have reached the absolute top of history
+    if [[ $HISTNO -eq 1 ]]; then
+      BUFFER=
+
+    # going up from somewhere below the top of history
+    else
+      zle up-history
+    fi
+
+    return true
+  fi
+
+  false
+}
+
+function _history-substring-search-down-history() {
+  #
+  # Behave like down-history in ZSH, except clear the
+  # $BUFFER when end of history is reached like in Fish.
+  #
+  if [[ -z $_history_substring_search_query ]]; then
+
+    # going down from the absolute top of history
+    if [[ $HISTNO -eq 1 && -z $BUFFER ]]; then
+      BUFFER=${history[1]}
+      _history_substring_search_move_cursor_eol=true
+
+    # going down from somewhere above the bottom of history
+    else
+      zle down-history
+    fi
+
+    return true
+  fi
+
+  false
+}
+
+function _history-substring-search-up-search() {
+  _history_substring_search_move_cursor_eol=true
+
+  #
+  # Highlight matches during history-substring-up-search:
+  #
+  # The following constants have been initialized in
+  # _history-substring-search-up/down-search():
+  #
+  # $_history_substring_search_matches is the current list of matches
+  # $_history_substring_search_matches_count is the current number of matches
+  # $_history_substring_search_matches_count_plus is the current number of matches + 1
+  # $_history_substring_search_matches_count_sans is the current number of matches - 1
+  # $_history_substring_search_match_index is the index of the current match
+  #
+  # The range of values that $_history_substring_search_match_index can take
+  # is: [0, $_history_substring_search_matches_count_plus].  A value of 0
+  # indicates that we are beyond the end of
+  # $_history_substring_search_matches. A value of
+  # $_history_substring_search_matches_count_plus indicates that we are beyond
+  # the beginning of $_history_substring_search_matches.
+  #
+  # In _history-substring-search-up-search() the initial value of
+  # $_history_substring_search_match_index is
+  # $_history_substring_search_matches_count_plus.  This value is set in
+  # _history-substring-search-begin().  _history-substring-search-up-search()
+  # will initially decrease it to $_history_substring_search_matches_count.
+  #
+  if [[ $_history_substring_search_match_index -ge 2 ]]; then
+    #
+    # Highlight the next match:
+    #
+    # 1. Decrease the value of $_history_substring_search_match_index.
+    #
+    # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+    #    to highlight the current buffer.
+    #
+    (( _history_substring_search_match_index-- ))
+    BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]]
+    _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+
+  elif [[ $_history_substring_search_match_index -eq 1 ]]; then
+    #
+    # We will move beyond the end of $_history_substring_search_matches:
+    #
+    # 1. Decrease the value of $_history_substring_search_match_index.
+    #
+    # 2. Save the current buffer in $_history_substring_search_old_buffer,
+    #    so that it can be retrieved by
+    #    _history-substring-search-down-search() later.
+    #
+    # 3. Make $BUFFER equal to $_history_substring_search_query.
+    #
+    # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
+    #    to highlight the current buffer.
+    #
+    (( _history_substring_search_match_index-- ))
+    _history_substring_search_old_buffer=$BUFFER
+    BUFFER=$_history_substring_search_query
+    _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
+
+  elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count_plus ]]; then
+    #
+    # We were beyond the beginning of $_history_substring_search_matches but
+    # UP makes us move back to $_history_substring_search_matches:
+    #
+    # 1. Decrease the value of $_history_substring_search_match_index.
+    #
+    # 2. Restore $BUFFER from $_history_substring_search_old_buffer.
+    #
+    # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+    #    to highlight the current buffer.
+    #
+    (( _history_substring_search_match_index-- ))
+    BUFFER=$_history_substring_search_old_buffer
+    _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+  fi
+}
+
+function _history-substring-search-down-search() {
+  _history_substring_search_move_cursor_eol=true
+
+  #
+  # Highlight matches during history-substring-up-search:
+  #
+  # The following constants have been initialized in
+  # _history-substring-search-up/down-search():
+  #
+  # $_history_substring_search_matches is the current list of matches
+  # $_history_substring_search_matches_count is the current number of matches
+  # $_history_substring_search_matches_count_plus is the current number of matches + 1
+  # $_history_substring_search_matches_count_sans is the current number of matches - 1
+  # $_history_substring_search_match_index is the index of the current match
+  #
+  # The range of values that $_history_substring_search_match_index can take
+  # is: [0, $_history_substring_search_matches_count_plus].  A value of 0
+  # indicates that we are beyond the end of
+  # $_history_substring_search_matches. A value of
+  # $_history_substring_search_matches_count_plus indicates that we are beyond
+  # the beginning of $_history_substring_search_matches.
+  #
+  # In _history-substring-search-down-search() the initial value of
+  # $_history_substring_search_match_index is
+  # $_history_substring_search_matches_count.  This value is set in
+  # _history-substring-search-begin().
+  # _history-substring-search-down-search() will initially increase it to
+  # $_history_substring_search_matches_count_plus.
+  #
+  if [[ $_history_substring_search_match_index -le $_history_substring_search_matches_count_sans ]]; then
+    #
+    # Highlight the next match:
+    #
+    # 1. Increase $_history_substring_search_match_index by 1.
+    #
+    # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+    #    to highlight the current buffer.
+    #
+    (( _history_substring_search_match_index++ ))
+    BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]]
+    _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+
+  elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count ]]; then
+    #
+    # We will move beyond the beginning of $_history_substring_search_matches:
+    #
+    # 1. Increase $_history_substring_search_match_index by 1.
+    #
+    # 2. Save the current buffer in $_history_substring_search_old_buffer, so
+    #    that it can be retrieved by _history-substring-search-up-search()
+    #    later.
+    #
+    # 3. Make $BUFFER equal to $_history_substring_search_query.
+    #
+    # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
+    #    to highlight the current buffer.
+    #
+    (( _history_substring_search_match_index++ ))
+    _history_substring_search_old_buffer=$BUFFER
+    BUFFER=$_history_substring_search_query
+    _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
+
+  elif [[ $_history_substring_search_match_index -eq 0 ]]; then
+    #
+    # We were beyond the end of $_history_substring_search_matches but DOWN
+    # makes us move back to the $_history_substring_search_matches:
+    #
+    # 1. Increase $_history_substring_search_match_index by 1.
+    #
+    # 2. Restore $BUFFER from $_history_substring_search_old_buffer.
+    #
+    # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+    #    to highlight the current buffer.
+    #
+    (( _history_substring_search_match_index++ ))
+    BUFFER=$_history_substring_search_old_buffer
+    _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
+  fi
+}
+
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
diff --git a/.zsh_plugins/history/history.plugin.zsh b/.zsh_plugins/history/history.plugin.zsh
new file mode 100644
index 0000000..0f4aa4b
--- /dev/null
+++ b/.zsh_plugins/history/history.plugin.zsh
@@ -0,0 +1,8 @@
+alias h='history'
+
+function hs
+{
+    history | grep $*
+}
+
+alias hsi='hs -i'
diff --git a/.zsh_plugins/iwhois/iwhois.plugin.zsh b/.zsh_plugins/iwhois/iwhois.plugin.zsh
new file mode 100644
index 0000000..38790bf
--- /dev/null
+++ b/.zsh_plugins/iwhois/iwhois.plugin.zsh
@@ -0,0 +1,8 @@
+# provide a whois command with a more accurate and up to date list of whois
+# servers using CNAMES via whois.geek.nz
+
+function iwhois() {
+    resolver="whois.geek.nz"
+    tld=`echo ${@: -1} | awk -F "." '{print $NF}'`
+    whois -h ${tld}.${resolver} "$@" ;
+}
diff --git a/.zsh_plugins/jake-node/jake-node.plugin.zsh b/.zsh_plugins/jake-node/jake-node.plugin.zsh
new file mode 100644
index 0000000..a9eef40
--- /dev/null
+++ b/.zsh_plugins/jake-node/jake-node.plugin.zsh
@@ -0,0 +1,14 @@
+#---oh-my-zsh plugin : task Autocomplete for Jake tool---
+# Jake : https://github.com/mde/jake
+# Warning : Jakefile should have the right case : Jakefile or jakefile
+# Tested on : MacOSX 10.7 (Lion), Ubuntu 11.10
+# Author : Alexandre Lacheze (@al3xstrat)
+# Inspiration : http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh 
+
+function _jake () {
+  if [ -f Jakefile ]||[ -f jakefile ]; then
+    compadd `jake -T | cut -d " " -f 2 | sed -E "s/.\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"`
+  fi
+}
+
+compdef _jake jake
\ No newline at end of file
diff --git a/.zsh_plugins/jira/jira.plugin.zsh b/.zsh_plugins/jira/jira.plugin.zsh
new file mode 100644
index 0000000..739ee71
--- /dev/null
+++ b/.zsh_plugins/jira/jira.plugin.zsh
@@ -0,0 +1,45 @@
+# To use: add a .jira-url file in the base of your project
+#         You can also set JIRA_URL in your .zshrc or put .jira-url in your home directory
+#         .jira-url in the current directory takes precedence
+#
+# If you use Rapid Board, set:
+#JIRA_RAPID_BOARD="true"
+# in you .zshrc
+#
+# Setup: cd to/my/project
+#        echo "https://name.jira.com" >> .jira-url
+# Usage: jira           # opens a new issue
+#        jira ABC-123   # Opens an existing issue
+open_jira_issue () {
+  local open_cmd
+  if [[ $(uname -s) == 'Darwin' ]]; then
+    open_cmd='open'
+  else
+    open_cmd='xdg-open'
+  fi
+
+  if [ -f .jira-url ]; then
+    jira_url=$(cat .jira-url)
+  elif [ -f ~/.jira-url ]; then
+    jira_url=$(cat ~/.jira-url)
+  elif [[ "x$JIRA_URL" != "x" ]]; then
+    jira_url=$JIRA_URL
+  else
+    echo "JIRA url is not specified anywhere."
+    return 0
+  fi
+
+  if [ -z "$1" ]; then
+    echo "Opening new issue"
+    $open_cmd "$jira_url/secure/CreateIssue!default.jspa"
+  else
+    echo "Opening issue #$1"
+    if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
+      $open_cmd  "$jira_url/issues/$1"
+    else
+      $open_cmd  "$jira_url/browse/$1"
+    fi
+  fi
+}
+
+alias jira='open_jira_issue'
diff --git a/.zsh_plugins/jruby/jruby.plugin.zsh b/.zsh_plugins/jruby/jruby.plugin.zsh
new file mode 100644
index 0000000..bb7975b
--- /dev/null
+++ b/.zsh_plugins/jruby/jruby.plugin.zsh
@@ -0,0 +1,4 @@
+# Aliases
+alias jrspec='jruby --debug -S rspec --debug'
+alias jprofile='jruby --profile.api -S rspec'
+alias jexec='jruby -S'
diff --git a/.zsh_plugins/jump/jump.plugin.zsh b/.zsh_plugins/jump/jump.plugin.zsh
new file mode 100644
index 0000000..5096879
--- /dev/null
+++ b/.zsh_plugins/jump/jump.plugin.zsh
@@ -0,0 +1,58 @@
+# Easily jump around the file system by manually adding marks
+# marks are stored as symbolic links in the directory $MARKPATH (default $HOME/.marks)
+#
+# jump FOO: jump to a mark named FOO
+# mark FOO: create a mark named FOO
+# unmark FOO: delete a mark
+# marks: lists all marks
+#
+export MARKPATH=$HOME/.marks
+
+jump() {
+	cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
+}
+
+mark() {
+	if (( $# == 0 )); then
+		MARK=$(basename "$(pwd)")
+	else
+		MARK="$1"
+	fi
+	if read -q \?"Mark $(pwd) as ${MARK}? (y/n) "; then
+		mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$MARK"
+	fi
+}
+
+unmark() {
+	rm -i "$MARKPATH/$1"
+}
+
+autoload colors
+marks() {
+	for link in $MARKPATH/*(@); do
+		local markname="$fg[cyan]${link:t}$reset_color"
+		local markpath="$fg[blue]$(readlink $link)$reset_color"
+		printf "%s\t" $markname
+		printf "-> %s \t\n" $markpath
+	done
+}
+
+_completemarks() {
+	if [[ $(ls "${MARKPATH}" | wc -l) -gt 1 ]]; then
+		reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g'))
+	else
+		if readlink -e "${MARKPATH}"/* &>/dev/null; then
+			reply=($(ls "${MARKPATH}"))
+		fi
+	fi
+}
+compctl -K _completemarks jump
+compctl -K _completemarks unmark
+
+_mark_expansion() {
+	setopt extendedglob
+	autoload -U modify-current-argument
+	modify-current-argument '$(readlink "$MARKPATH/$ARG")'
+}
+zle -N _mark_expansion
+bindkey "^g" _mark_expansion
diff --git a/.zsh_plugins/kate/kate.plugin.zsh b/.zsh_plugins/kate/kate.plugin.zsh
new file mode 100644
index 0000000..eb16522
--- /dev/null
+++ b/.zsh_plugins/kate/kate.plugin.zsh
@@ -0,0 +1,9 @@
+
+# Kate
+# Start kate always silent
+alias kate='kate >/dev/null 2>&1'
+
+function kt () {
+  cd $1
+  kate $1
+}
\ No newline at end of file
diff --git a/.zsh_plugins/knife/_knife b/.zsh_plugins/knife/_knife
new file mode 100644
index 0000000..b44283f
--- /dev/null
+++ b/.zsh_plugins/knife/_knife
@@ -0,0 +1,198 @@
+#compdef knife
+
+# You can override the path to knife.rb and your cookbooks by setting
+# KNIFE_CONF_PATH=/path/to/my/.chef/knife.rb
+# KNIFE_COOKBOOK_PATH=/path/to/my/chef/cookbooks
+# Read around where these are used for more detail.
+
+# These flags should be available everywhere according to man knife
+knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
+
+# knife has a very special syntax, some example calls are:
+# knife status
+# knife cookbook list
+# knife role show ROLENAME
+# knife data bag show DATABAGNAME
+# knife role show ROLENAME --attribute ATTRIBUTENAME
+# knife cookbook show COOKBOOKNAME COOKBOOKVERSION recipes
+
+# 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
+_knife() {
+  local curcontext="$curcontext" state line
+  typeset -A opt_args
+  cloudproviders=(bluebox ec2 rackspace slicehost terremark)
+  _arguments \
+    '1: :->knifecmd'\
+    '2: :->knifesubcmd'\
+    '3: :->knifesubcmd2' \
+    '4: :->knifesubcmd3' \
+    '5: :->knifesubcmd4' \
+    '6: :->knifesubcmd5'
+  
+  case $state in
+  knifecmd)
+    compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff exec environment index node recipe role search ssh status upload windows $cloudproviders
+  ;;
+  knifesubcmd)
+    case $words[2] in
+    (bluebox|ec2|rackspace|slicehost|terremark)
+      compadd "$@" server images
+    ;;
+    client)
+      compadd -Q "$@" "bulk delete" list create show delete edit reregister
+    ;;
+    configure)
+      compadd "$@" client
+    ;;
+    cookbook)
+      compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
+    ;;
+    diff)
+      _arguments '*:file or directory:_files -g "*"'
+    ;;
+    environment)
+      compadd -Q "$@" list create delete edit show "from file"
+    ;;
+    node)
+     compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
+    ;;
+    recipe)
+     compadd "$@" list
+    ;;
+    role)
+      compadd -Q "$@" "bulk delete" create delete edit "from file" list show
+    ;; 
+    upload)
+     _arguments '*:file or directory:_files -g "*"'
+    ;;
+    windows)
+      compadd "$@" bootstrap
+    ;;
+    *)
+    _arguments '2:Subsubcommands:($(_knife_options1))'
+    esac
+   ;;
+   knifesubcmd2)
+    case $words[3] in
+     server)
+      compadd "$@" list create delete
+    ;;
+     images)
+      compadd "$@" list
+    ;;
+     site)
+      compadd "$@" vendor show share search download list unshare
+    ;;
+     (show|delete|edit)
+     _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))'
+    ;;
+    (upload|test)
+     _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)'
+    ;;
+    list)
+     compadd -a "$@" knife_general_flags
+    ;;
+    bag)
+      compadd -Q "$@" show edit list "from file" create delete
+    ;;
+    *)
+      _arguments '3:Subsubcommands:($(_knife_options2))'
+    esac
+   ;;
+   knifesubcmd3)
+     case $words[3] in
+      show)
+       case $words[2] in
+       cookbook)
+          versioncomp=1
+          _arguments '4:Cookbookversions:($(_cookbook_versions) latest)'
+       ;;
+       (node|client|role)
+         compadd "$@" --attribute
+       esac
+     esac
+     case $words[4] in
+     (show|edit)
+     _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))'
+    ;;
+     file)
+     _arguments '*:file or directory:_files -g "*.(rb|json)"'
+    ;;
+      list)
+     compadd -a "$@" knife_general_flags
+    ;;
+        *)
+       _arguments '*:Subsubcommands:($(_knife_options3))'
+    esac
+    ;;
+    knifesubcmd4)
+      if (( versioncomp > 0 )); then
+        compadd "$@" attributes definitions files libraries providers recipes resources templates
+      else
+       _arguments '*:Subsubcommands:($(_knife_options2))'
+      fi
+    ;; 
+    knifesubcmd5) 
+      _arguments '*:Subsubcommands:($(_knife_options3))'
+   esac
+}
+
+# Helper functions to provide the argument completion for several depths of commands
+_knife_options1() {
+ ( for line in $( knife $words[2] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
+}
+
+_knife_options2() {
+ ( for line in $( knife $words[2] $words[3] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
+}
+
+_knife_options3() {
+ ( for line in $( knife $words[2] $words[3] $words[4] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
+}
+
+# The chef_x_remote functions use knife to get a list of objects of type x on the server
+_chef_roles_remote() {
+ (knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+}
+
+_chef_clients_remote() {
+ (knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+}
+
+_chef_nodes_remote() {
+ (knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+}
+
+_chef_cookbooks_remote() {
+ (knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+}
+
+_chef_sitecookbooks_remote() {
+ (knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+}
+
+_chef_data_bags_remote() {
+ (knife data bag list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+}
+
+_chef_environments_remote() {
+  (knife environment list | awk '{print $1}')
+}
+
+# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
+_chef_cookbooks_local() {
+  
+  local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb}
+  if [ -f ./.chef/knife.rb ]; then
+    knife_rb="./.chef/knife.rb"
+  fi
+  local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )}
+  (for i in $cookbook_path; do ls $i; done)
+}
+
+# This function extracts the available cookbook versions on the chef server
+_cookbook_versions() {
+  (knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g')
+}
+
+_knife "$@"
diff --git a/.zsh_plugins/knife_ssh/knife_ssh.plugin.zsh b/.zsh_plugins/knife_ssh/knife_ssh.plugin.zsh
new file mode 100644
index 0000000..7fdd42a
--- /dev/null
+++ b/.zsh_plugins/knife_ssh/knife_ssh.plugin.zsh
@@ -0,0 +1,18 @@
+function knife_ssh() {
+  grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~;
+  ssh $(knife node show $1 | awk '/IP:/{print $2}')
+}
+
+_knife_ssh() {
+  if hash knife 2>/dev/null; then
+    if [[ ! -f ~/.knife_comp~ ]]; then
+      echo "\nGenerating ~/.knife_comp~..." >/dev/stderr
+      knife node list > ~/.knife_comp~
+    fi
+    compadd $(<~/.knife_comp~)
+  else
+    echo "Could not find knife" > /dev/stderr;
+  fi
+}
+
+compdef _knife_ssh knife_ssh
diff --git a/.zsh_plugins/laravel/_artisan b/.zsh_plugins/laravel/_artisan
new file mode 100644
index 0000000..8637514
--- /dev/null
+++ b/.zsh_plugins/laravel/_artisan
@@ -0,0 +1,40 @@
+#compdef artisan
+
+# Laravel autocompletion
+# Author: John Hamelink 
+#
+# This plugin does the following:
+#  - Adds aliases and autocompletion for artisan
+#  - Adds aliases and autocompletion for bob
+
+local curcontext="$curcontext" state line _opts _bundles ret=1
+_arguments -C \
+    '1: :->cmds' \
+    '*:: :->args' && ret=0
+
+case $state in
+    cmds)
+
+    _values "Artisan command" \
+        'session\:install[Create a session table]' \
+        'migrate[Manage Migrations]' \
+        'test[Run a test]' \
+        'route\:\:call[Call a route in the CLI]' \
+        'key\:\:generate[Generate a key]'
+        ret=0
+        ;;
+    args)
+        case $line[1] in
+            migrate)
+                _values \
+                    'install[Create the Laravel migration table' \
+                    'make[Create a migration]' \
+                    'rollback[Roll back to the last migration operation]' \
+                    'reset[Roll back all migrations that have ever run]'
+                ret=0
+                ;;
+        esac
+        ;;
+esac
+
+return ret
diff --git a/.zsh_plugins/laravel/laravel.plugin.zsh b/.zsh_plugins/laravel/laravel.plugin.zsh
new file mode 100644
index 0000000..ed932ee
--- /dev/null
+++ b/.zsh_plugins/laravel/laravel.plugin.zsh
@@ -0,0 +1,3 @@
+#!zsh
+alias artisan='php artisan'
+alias bob='php artisan bob::build'
diff --git a/.zsh_plugins/last-working-dir/last-working-dir.plugin.zsh b/.zsh_plugins/last-working-dir/last-working-dir.plugin.zsh
new file mode 100644
index 0000000..bc36c80
--- /dev/null
+++ b/.zsh_plugins/last-working-dir/last-working-dir.plugin.zsh
@@ -0,0 +1,25 @@
+#!/usr/bin/env zsh
+# Keeps track of the last used working directory and automatically jumps
+# into it for new shells.
+
+# Flag indicating if we've previously jumped to last directory.
+typeset -g ZSH_LAST_WORKING_DIRECTORY
+mkdir -p "$ZSH/cache"
+local cache_file="$ZSH/cache/last-working-dir"
+
+# Updates the last directory once directory is changed.
+function chpwd() {
+  # Use >| in case noclobber is set to avoid "file exists" error
+	pwd >| "$cache_file"
+}
+
+# Changes directory to the last working directory.
+function lwd() {
+	[[ ! -r "$cache_file" ]] || cd `cat "$cache_file"`
+}
+
+# Automatically jump to last working directory unless this isn't the first time
+# this plugin has been loaded.
+if [[ -z "$ZSH_LAST_WORKING_DIRECTORY" ]]; then
+	lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true
+fi
diff --git a/.zsh_plugins/lein/lein.plugin.zsh b/.zsh_plugins/lein/lein.plugin.zsh
new file mode 100644
index 0000000..11c9297
--- /dev/null
+++ b/.zsh_plugins/lein/lein.plugin.zsh
@@ -0,0 +1,41 @@
+function _lein_commands() {
+    local ret=1 state
+    _arguments ':subcommand:->subcommand' && ret=0
+
+    case $state in
+      subcommand)
+        subcommands=(
+          "classpath:print the classpath of the current project"
+          "clean:remove compiled files and dependencies from project"
+          "compile:ahead-of-time compile the project"
+          "deploy:build jar and deploy to remote repository"
+          "deps:download and install all dependencies"
+          "help:display a list of tasks or help for a given task"
+          "install:install the project and its dependencies in your local repository"
+          "int:enter an interactive task shell"
+          "interactive:enter an interactive task shell"
+          "jack-in:jack in to a clojure slime session from emacs."
+          "jar:create a jar file containing the compiled .class files"
+          "javac:compile java source files"
+          "new:create a new project skeleton"
+          "plugin:manage user-level plugins"
+          "pom:write a pom.xml file to disk for maven interop"
+          "repl:start a repl session either with the current project or standalone"
+          "retest:run only the test namespaces which failed last time around"
+          "run:run the project's -main function"
+          "search:search remote maven repositories for matching jars"
+          "swank:launch swank server for Emacs to connect"
+          "test:run the project's tests"
+          "test!:run a project's tests after cleaning and fetching dependencies"
+          "trampoline:run a task without nesting the project's JVM inside Leiningen's."
+          "uberjar:Create a jar including the contents of each of deps"
+          "upgrade:upgrade leiningen to the latest stable release"
+          "version:print leiningen's version"
+        )
+        _describe -t subcommands 'leiningen subcommands' subcommands && ret=0
+    esac
+
+    return ret
+}
+
+compdef _lein_commands lein
diff --git a/.zsh_plugins/lighthouse/lighthouse.plugin.zsh b/.zsh_plugins/lighthouse/lighthouse.plugin.zsh
new file mode 100644
index 0000000..7661c6a
--- /dev/null
+++ b/.zsh_plugins/lighthouse/lighthouse.plugin.zsh
@@ -0,0 +1,16 @@
+# To use: add a .lighthouse file into your directory with the URL to the
+# individual project. For example:
+# https://rails.lighthouseapp.com/projects/8994
+# Example usage: http://screencast.com/t/ZDgwNDUwNT
+open_lighthouse_ticket () {
+  if [ ! -f .lighthouse-url ]; then
+    echo "There is no .lighthouse-url file in the current directory..."
+    return 0;
+  else
+    lighthouse_url=$(cat .lighthouse-url);
+    echo "Opening ticket #$1";
+    `open $lighthouse_url/tickets/$1`;
+  fi
+}
+
+alias lho='open_lighthouse_ticket'
diff --git a/.zsh_plugins/lol/lol.plugin.zsh b/.zsh_plugins/lol/lol.plugin.zsh
new file mode 100644
index 0000000..ae065c1
--- /dev/null
+++ b/.zsh_plugins/lol/lol.plugin.zsh
@@ -0,0 +1,38 @@
+# LOL!!1
+# Source: http://aur.archlinux.org/packages/lolbash/lolbash/lolbash.sh
+
+alias wtf='dmesg'
+alias onoz='cat /var/log/errors.log'
+alias rtfm='man'
+
+alias :3='echo'
+alias visible='echo'
+alias invisible='cat'
+alias moar='more'
+alias tldr='less'
+alias alwayz='tail -f'
+
+alias icanhas='mkdir'
+alias gimmeh='touch'
+alias donotwant='rm'
+alias dowant='cp'
+alias gtfo='mv'
+alias nowai='chmod'
+
+alias hai='cd'
+alias iz='ls'
+alias plz='pwd'
+alias ihasbucket='df -h'
+
+alias inur='locate'
+alias iminurbase='finger'
+
+alias btw='nice'
+alias obtw='nohup'
+
+alias nomz='ps aux'
+alias nomnom='killall'
+
+alias byes='exit'
+alias cya='reboot'
+alias kthxbai='halt'
diff --git a/.zsh_plugins/macports/_port b/.zsh_plugins/macports/_port
new file mode 100644
index 0000000..06d7fb4
--- /dev/null
+++ b/.zsh_plugins/macports/_port
@@ -0,0 +1,89 @@
+#compdef port
+
+local subcmds 
+
+# we cache the list of ports
+# we shall use some cache policy to avoid problems with new ports
+if (( ! $+portlist )); then
+	portlist=($(port echo all; echo "all current active inactive installed uninstalled outdated"))
+fi
+
+subcmds=(
+'activate'
+'archive'
+'build'
+'cat'
+'clean'
+'configure'
+'contents'
+'deactivate'
+'dependents'
+'deps'
+'destroot'
+'dir'
+'distcheck'
+'distclean'
+'dmg'
+'echo'
+'edit'
+'extract'
+'fetch'
+'file'
+'help'
+'info'
+'install' 
+'installed' 
+'list'
+'livecheck'
+'location'
+'mpkg'
+'outdated'
+'patch'
+'pkg'
+'provides'
+'rpmpackage'
+'search'
+'selfupdate'
+'sync'
+'test'
+'unarchive'
+'uninstall'
+'upgrade' 
+'variants'
+'version'
+)
+
+_arguments -C \
+'-v[verbose mode (generate verbose messages)]' \
+'-d[debug mode (generate debugging messages)]' \
+'-q[quiet mode (suppress messages)]' \
+'-D[specify portdir]' \
+'-k[keep mode (do not autoclean after install)]' \
+'-n[dont follow dependencies in upgrade (only for upgrading)]' \
+'-a[upgrade all installed ports (only for upgrading)]' \
+'-u[uninstall non-active ports when upgrading and uninstalling]' \
+'-f[force mode (ignore state file)]' \
+'-s[source-only mode]' \
+'-b[binary-only mode]' \
+'-o[honor state files older than Portfile]' \
+'*::command:->command' \
+&& return 0
+
+case $state in
+	command)
+	if ((CURRENT == 1)); then
+		state=subcommands
+	else
+		state=portname
+	fi
+	;;
+esac
+
+case $state in
+	subcommands)
+	_describe -t commands 'port commands' subcmds
+	;;
+	portname)
+	_describe -t commands 'available ports' portlist
+	;;
+esac
diff --git a/.zsh_plugins/macports/macports.plugin.zsh b/.zsh_plugins/macports/macports.plugin.zsh
new file mode 100644
index 0000000..277352e
--- /dev/null
+++ b/.zsh_plugins/macports/macports.plugin.zsh
@@ -0,0 +1,8 @@
+#Aliases
+alias pc="sudo port clean --all installed"
+alias pi="sudo port install $1"
+alias psu="sudo port selfupdate"
+alias puni="sudo port uninstall inactive"
+alias puo="sudo port upgrade outdated"
+alias pup="psu && puo"
+
diff --git a/.zsh_plugins/mercurial/mercurial.plugin.zsh b/.zsh_plugins/mercurial/mercurial.plugin.zsh
new file mode 100644
index 0000000..d2db89d
--- /dev/null
+++ b/.zsh_plugins/mercurial/mercurial.plugin.zsh
@@ -0,0 +1,64 @@
+# Mercurial
+alias hgc='hg commit'
+alias hgb='hg branch'
+alias hgba='hg branches'
+alias hgbk='hg bookmarks'
+alias hgco='hg checkout'
+alias hgd='hg diff'
+alias hged='hg diffmerge'
+# pull and update
+alias hgi='hg incoming'
+alias hgl='hg pull -u'
+alias hglr='hg pull --rebase'
+alias hgo='hg outgoing'
+alias hgp='hg push'
+alias hgs='hg status'
+alias hgsl='log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n" '
+# this is the 'git commit --amend' equivalent
+alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
+
+function in_hg() {
+  if [[ -d .hg ]] || $(hg summary > /dev/null 2>&1); then
+    echo 1
+  fi
+}
+
+function hg_get_branch_name() {
+  if [ $(in_hg) ]; then
+    echo $(hg branch)
+  fi
+}
+
+function hg_prompt_info {
+  if [ $(in_hg) ]; then
+    _DISPLAY=$(hg_get_branch_name)
+    echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_PREFIX\
+$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(hg_dirty)$ZSH_PROMPT_BASE_COLOR"
+    unset _DISPLAY
+  fi
+}
+
+function hg_dirty_choose {
+  if [ $(in_hg) ]; then
+    hg status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'
+    if [ $pipestatus[-1] -eq 0 ]; then
+      # Grep exits with 0 when "One or more lines were selected", return "dirty".
+      echo $1
+    else
+      # Otherwise, no lines were found, or an error occurred. Return clean.
+      echo $2
+    fi
+  fi
+}
+
+function hg_dirty {
+  hg_dirty_choose $ZSH_THEME_HG_PROMPT_DIRTY $ZSH_THEME_HG_PROMPT_CLEAN
+}
+
+function hgic() {
+    hg incoming "$@" | grep "changeset" | wc -l
+}
+
+function hgoc() {
+    hg outgoing "$@" | grep "changeset" | wc -l
+}
diff --git a/.zsh_plugins/mix/_mix b/.zsh_plugins/mix/_mix
new file mode 100644
index 0000000..602f5ff
--- /dev/null
+++ b/.zsh_plugins/mix/_mix
@@ -0,0 +1,63 @@
+#compdef mix 
+#autoload
+
+# Elixir mix zsh completion
+
+local -a _1st_arguments
+_1st_arguments=(
+    'archive:Archive this project into a .ez file'
+    'clean:Clean generated application files'
+    'compile:Compile source files'
+    'deps:List dependencies and their status'
+    "deps.clean:Remove dependencies' files"
+    'deps.compile:Compile dependencies'
+    'deps.get:Get all out of date dependencies'
+    'deps.unlock:Unlock the given dependencies'
+    'deps.update:Update dependencies'
+    'do:Executes the commands separated by comma'
+    'escriptize:Generates an escript for the project'
+    'help:Print help information for tasks'
+    'local:List local tasks'
+    'local.install:Install a task or an archive locally'
+    'local.rebar:Install rebar locally'
+    'local.uninstall:Uninstall local tasks or archives'
+    'new:Creates a new Elixir project'
+    'run:Run the given file or expression'
+    "test:Run a project's tests"
+    '--help:Describe available tasks'
+    '--version:Prints the Elixir version information'
+)
+
+__task_list ()
+{
+    local expl
+    declare -a tasks
+
+    tasks=(archive clean compile deps deps.clean deps.compile deps.get deps.unlock deps.update do escriptize help local local.install local.rebar local.uninstall new run test)
+
+    _wanted tasks expl 'help' compadd $tasks
+}
+
+local expl
+
+local curcontext="$curcontext" state line
+typeset -A opt_args
+
+_arguments -C \
+    ':command:->command' \
+    '*::options:->options'
+
+case $state in
+  (command)
+      _describe -t commands "mix subcommand" _1st_arguments
+      return
+  ;;
+
+  (options)
+    case $line[1] in
+      (help)
+         _arguments ':feature:__task_list' 
+    esac
+  ;;
+esac
+
diff --git a/.zsh_plugins/mosh/mosh.plugin.zsh b/.zsh_plugins/mosh/mosh.plugin.zsh
new file mode 100644
index 0000000..ea36b7e
--- /dev/null
+++ b/.zsh_plugins/mosh/mosh.plugin.zsh
@@ -0,0 +1,2 @@
+# Allow SSH tab completion for mosh hostnames
+compdef mosh=ssh
diff --git a/.zsh_plugins/mvn/mvn.plugin.zsh b/.zsh_plugins/mvn/mvn.plugin.zsh
new file mode 100644
index 0000000..0c91419
--- /dev/null
+++ b/.zsh_plugins/mvn/mvn.plugin.zsh
@@ -0,0 +1,172 @@
+# mvn-color based on https://gist.github.com/1027800
+export BOLD=`tput bold`
+export UNDERLINE_ON=`tput smul`
+export UNDERLINE_OFF=`tput rmul`
+export TEXT_BLACK=`tput setaf 0`
+export TEXT_RED=`tput setaf 1`
+export TEXT_GREEN=`tput setaf 2`
+export TEXT_YELLOW=`tput setaf 3`
+export TEXT_BLUE=`tput setaf 4`
+export TEXT_MAGENTA=`tput setaf 5`
+export TEXT_CYAN=`tput setaf 6`
+export TEXT_WHITE=`tput setaf 7`
+export BACKGROUND_BLACK=`tput setab 0`
+export BACKGROUND_RED=`tput setab 1`
+export BACKGROUND_GREEN=`tput setab 2`
+export BACKGROUND_YELLOW=`tput setab 3`
+export BACKGROUND_BLUE=`tput setab 4`
+export BACKGROUND_MAGENTA=`tput setab 5`
+export BACKGROUND_CYAN=`tput setab 6`
+export BACKGROUND_WHITE=`tput setab 7`
+export RESET_FORMATTING=`tput sgr0`
+
+ 
+# Wrapper function for Maven's mvn command.
+mvn-color()
+{
+  (
+  # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations
+  unset LANG
+  LC_CTYPE=C mvn $@ | sed -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \
+               -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \
+               -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \
+               -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \
+               -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g"
+ 
+  # Make sure formatting is reset
+  echo -ne ${RESET_FORMATTING}
+  )
+}
+ 
+# Override the mvn command with the colorized one.
+#alias mvn="mvn-color"
+
+# aliases
+alias mvncie='mvn clean install eclipse:eclipse'
+alias mvnci='mvn clean install'
+alias mvne='mvn eclipse:eclipse'
+alias mvnce='mvn clean eclipse:clean eclipse:eclipse'
+alias mvnd='mvn deploy'
+alias mvnp='mvn package'
+alias mvnc='mvn clean'
+alias mvncom='mvn compile'
+alias mvnt='mvn test'
+alias mvnag='mvn archetype:generate'
+
+function listMavenCompletions { 
+     reply=(
+        # common lifecycle
+        clean process-resources compile process-test-resources test-compile test package verify install deploy site
+        
+        # common plugins
+        deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt
+       
+        # deploy
+        deploy:deploy-file
+        # failsafe
+        failsafe:integration-test failsafe:verify
+        # install
+        install:install-file
+        # site
+        site:site site:deploy site:run site:stage site:stage-deploy
+        # surefire
+        surefire:test
+            
+        # checkstyle
+        checkstyle:checkstyle checkstyle:check
+        # javadoc
+        javadoc:javadoc javadoc:jar javadoc:aggregate
+        # jxr
+        jxr:jxr
+        # pmd
+        pmd:pmd pmd:cpd pmd:check pmd:cpd-check
+
+        # ant
+        ant:ant ant:clean
+        # antrun
+        antrun:run
+        # archetype
+        archetype:generate archetype:create-from-project archetype:crawl
+        # assembly
+        assembly:single assembly:assembly
+        # dependency
+        dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:get dependency:go-offline dependency:list dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies
+        # enforcer
+        enforcer:enforce
+        # gpg
+        gpg:sign gpg:sign-and-deploy-file
+        # help
+        help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system
+        # release
+        release:clean release:prepare release:rollback release:perform release:stage release:branch release:update-versions
+        # repository
+        repository:bundle-create repository:bundle-pack
+        # source
+        source:aggregate source:jar source:jar-no-fork
+            
+        # eclipse
+        eclipse:clean eclipse:eclipse
+        # idea
+        idea:clean idea:idea
+            
+        # jetty
+        jetty:run jetty:run-exploded
+        # cargo
+        cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help
+        # jboss
+        jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy
+        # tomcat
+        tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy
+        # tomcat6
+        tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy
+        # tomcat7
+        tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy
+        # exec
+        exec:exec exec:java
+        # versions
+        versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert
+        # scm
+        scm:add scm:checkin scm:checkout scm:update scm:status
+        # buildnumber
+        buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset
+
+        # war
+        war:war war:exploded war:inplace war:manifest
+        # ear
+        ear:ear ear:generate-application-xml
+        # ejb
+        ejb:ejb
+        # android
+        android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices
+        # nexus
+        nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download
+        # repository
+        repository:bundle-create repository:bundle-pack repository:help
+
+        # sonar
+        sonar:sonar
+        # license
+        license:format license:check
+        # hibernate3
+        hibernate3:hbm2ddl hibernate3:help
+        # liquibase
+        liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback
+        # flyway
+        flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate
+        # gwt
+        gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test
+
+        # options
+        -Dmaven.test.skip=true -DskipTests -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven
+
+        # arguments
+        -am -amd -B -C -c -cpu -D -e -emp -ep -f -fae -ff -fn -gs -h -l -N -npr -npu -nsu -o -P -pl -q -rf -s -T -t -U -up -V -v -X
+
+        cli:execute cli:execute-phase 
+        archetype:generate generate-sources 
+        cobertura:cobertura
+        -Dtest= `if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`
+    ); 
+}
+
+compctl -K listMavenCompletions mvn
diff --git a/.zsh_plugins/mysql-macports/mysql-macports.plugin.zsh b/.zsh_plugins/mysql-macports/mysql-macports.plugin.zsh
new file mode 100644
index 0000000..c39563f
--- /dev/null
+++ b/.zsh_plugins/mysql-macports/mysql-macports.plugin.zsh
@@ -0,0 +1,8 @@
+# commands to control local mysql-server installation
+# paths are for osx installation via macports
+
+alias mysqlstart='sudo /opt/local/share/mysql5/mysql/mysql.server start'
+alias mysqlstop='sudo /opt/local/share/mysql5/mysql/mysql.server stop'
+alias mysqlrestart='sudo /opt/local/share/mysql5/mysql/mysql.server restart'
+
+alias mysqlstatus='mysqladmin5 -u root -p ping'
diff --git a/.zsh_plugins/nanoc/_nanoc b/.zsh_plugins/nanoc/_nanoc
new file mode 100644
index 0000000..fde07c3
--- /dev/null
+++ b/.zsh_plugins/nanoc/_nanoc
@@ -0,0 +1,44 @@
+#compdef nanoc
+#autoload
+
+# nanoc zsh completion - based on the homebrew zsh completion
+# requires the 'nanoc' gem to be installed
+
+local -a _1st_arguments
+_1st_arguments=(
+  'autocompile:start the autocompiler'
+  'compile:compile items of this site'
+  'create-item:create an item'
+  'create-layout:create a layout'
+  'create-site:create a site'
+  'deploy:deploy the compiled site'
+  'help:show help'
+  'prune:remove files not managed by nanoc from the output directory'
+  'show-data:show data in this site'
+  'show-plugins:show all available plugins'
+  'show-rules:describe the rules for each item'
+  'update:update the data stored by the data source to a newer version'
+  'validate-css:validate the site’s CSS'
+  'validate-html:validate the site’s HTML'
+  'validate-links:validate links in site'
+  'view:start the web server that serves static files'
+  'watch:start the watcher'
+)
+
+local expl
+local -a pkgs installed_pkgs
+
+_arguments \
+  '(--color)--color[enable color]' \
+  '(--debug)--debug[enable debugging]' \
+  '(--help)--help[show the help message and quit]' \
+  '(--no-color)--no-color[disable color]' \
+  '(--verbose)--verbose[make nanoc output more detailed]' \
+  '(--version)--version[show version information and quit]' \
+  '(--warn)--warn[enable warnings]' \
+  '*:: :->subcmds' && return 0
+
+if (( CURRENT == 1 )); then
+  _describe -t commands "nanoc subcommand" _1st_arguments
+  return
+fi
diff --git a/.zsh_plugins/nanoc/nanoc.plugin.zsh b/.zsh_plugins/nanoc/nanoc.plugin.zsh
new file mode 100644
index 0000000..5a50646
--- /dev/null
+++ b/.zsh_plugins/nanoc/nanoc.plugin.zsh
@@ -0,0 +1,9 @@
+alias n='nanoc'
+alias na='nanoc autocompile'
+alias nco='nanoc compile'
+alias nci='nanoc create_item'
+alias ncl='nanoc create_layout'
+alias ncs='nanoc create_site'
+alias nd='nanoc deploy'
+alias nv='nanoc view'
+alias nw='nanoc watch'
diff --git a/.zsh_plugins/node/node.plugin.zsh b/.zsh_plugins/node/node.plugin.zsh
new file mode 100644
index 0000000..2d78f2b
--- /dev/null
+++ b/.zsh_plugins/node/node.plugin.zsh
@@ -0,0 +1,13 @@
+# Open the node api for your current version to the optional section.
+# TODO: Make the section part easier to use.
+function node-docs {
+  # get the open command
+  local open_cmd
+  if [[ $(uname -s) == 'Darwin' ]]; then
+    open_cmd='open'
+  else
+    open_cmd='xdg-open'
+  fi
+
+  $open_cmd "http://nodejs.org/docs/$(node --version)/api/all.html#all_$1"
+}
diff --git a/.zsh_plugins/npm/npm.plugin.zsh b/.zsh_plugins/npm/npm.plugin.zsh
new file mode 100644
index 0000000..c3eb91d
--- /dev/null
+++ b/.zsh_plugins/npm/npm.plugin.zsh
@@ -0,0 +1 @@
+eval "$(npm completion 2>/dev/null)"
diff --git a/.zsh_plugins/nvm/_nvm b/.zsh_plugins/nvm/_nvm
new file mode 100644
index 0000000..a95c9e3
--- /dev/null
+++ b/.zsh_plugins/nvm/_nvm
@@ -0,0 +1,26 @@
+#compdef nvm
+#autoload
+
+[[ -s ~/.nvm/nvm.sh ]] || return 0
+
+local -a _1st_arguments
+_1st_arguments=(
+  'help:show help'
+  'install:download and install a version'
+  'uninstall:uninstall a version'
+  'use:modify PATH to use version'
+  'run:run version with given arguments'
+  'ls:list installed versions or versions matching a given description'
+  'ls-remote:list remote versions available for install'
+  'deactivate:undo effects of NVM on current shell'
+  'alias:show or set aliases'
+  'unalias:deletes an alias'
+  'copy-packages:install global NPM packages to current version'
+)
+
+_arguments -C '*:: :->subcmds' && return 0
+
+if (( CURRENT == 1 )); then
+  _describe -t commands "nvm subcommand" _1st_arguments
+  return
+fi
\ No newline at end of file
diff --git a/.zsh_plugins/nvm/nvm.plugin.zsh b/.zsh_plugins/nvm/nvm.plugin.zsh
new file mode 100644
index 0000000..9709719
--- /dev/null
+++ b/.zsh_plugins/nvm/nvm.plugin.zsh
@@ -0,0 +1,3 @@
+# The addition 'nvm install' attempts in ~/.profile
+
+[[ -s ~/.nvm/nvm.sh ]] && . ~/.nvm/nvm.sh
diff --git a/.zsh_plugins/nyan/nyan.plugin.zsh b/.zsh_plugins/nyan/nyan.plugin.zsh
new file mode 100644
index 0000000..ac9d001
--- /dev/null
+++ b/.zsh_plugins/nyan/nyan.plugin.zsh
@@ -0,0 +1,5 @@
+if [[ -x `which nc` ]]; then
+  alias nyan='nc -v nyancat.dakko.us 23' # nyan cat
+fi
+
+
diff --git a/.zsh_plugins/osx/_man-preview b/.zsh_plugins/osx/_man-preview
new file mode 100644
index 0000000..6cc344a
--- /dev/null
+++ b/.zsh_plugins/osx/_man-preview
@@ -0,0 +1,5 @@
+#compdef man-preview
+#autoload
+
+_man
+
diff --git a/.zsh_plugins/osx/osx.plugin.zsh b/.zsh_plugins/osx/osx.plugin.zsh
new file mode 100644
index 0000000..608ec37
--- /dev/null
+++ b/.zsh_plugins/osx/osx.plugin.zsh
@@ -0,0 +1,193 @@
+# ------------------------------------------------------------------------------
+#          FILE:  osx.plugin.zsh
+#   DESCRIPTION:  oh-my-zsh plugin file.
+#        AUTHOR:  Sorin Ionescu (sorin.ionescu@gmail.com)
+#       VERSION:  1.1.0
+# ------------------------------------------------------------------------------
+
+function tab() {
+  local command="cd \\\"$PWD\\\"; clear; "
+  (( $# > 0 )) && command="${command}; $*"
+
+  the_app=$(
+    osascript 2>/dev/null </dev/null </dev/null < 0 )) && command="${command}; $*"
+
+  the_app=$(
+    osascript 2>/dev/null </dev/null < 0 )) && command="${command}; $*"
+
+  the_app=$(
+    osascript 2>/dev/null </dev/null </dev/null </dev/null < 0 )) && qlmanage -p $* &>/dev/null &
+}
+
+function man-preview() {
+  man -t "$@" | open -f -a Preview
+}
+
+function trash() {
+  local trash_dir="${HOME}/.Trash"
+  local temp_ifs=$IFS
+  IFS=$'\n'
+  for item in "$@"; do
+    if [[ -e "$item" ]]; then
+      item_name="$(basename $item)"
+      if [[ -e "${trash_dir}/${item_name}" ]]; then
+        mv -f "$item" "${trash_dir}/${item_name} $(date "+%H-%M-%S")"
+      else
+        mv -f "$item" "${trash_dir}/"
+      fi
+    fi
+  done
+  IFS=$temp_ifs
+}
+
+function vncviewer() {
+  open vnc://$@
+}
+
+# iTunes control function
+function itunes() {
+	local opt=$1
+	shift
+	case "$opt" in
+		launch|play|pause|stop|rewind|resume|quit)
+			;;
+		mute)
+			opt="set mute to true"
+			;;
+		unmute)
+			opt="set mute to false"
+			;;
+		next|previous)
+			opt="$opt track"
+			;;
+		""|-h|--help)
+			echo "Usage: itunes