summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ant/ant.plugin.zsh16
-rw-r--r--plugins/archlinux/archlinux.plugin.zsh4
-rw-r--r--plugins/battery/battery.plugin.zsh45
-rwxr-xr-xplugins/bower/_bower58
-rw-r--r--plugins/bower/bower.plugin.zsh38
-rw-r--r--plugins/bundler/_bundler9
-rw-r--r--plugins/bundler/bundler.plugin.zsh2
-rw-r--r--plugins/cake/cake.plugin.zsh11
-rw-r--r--plugins/capistrano/_capistrano2
-rw-r--r--plugins/colored-man/colored-man.plugin.zsh11
-rw-r--r--plugins/colorize/colorize.plugin.zsh28
-rw-r--r--plugins/command-not-found/command-not-found.plugin.zsh4
-rw-r--r--plugins/composer/composer.plugin.zsh5
-rw-r--r--plugins/copydir/copydir.plugin.zsh3
-rw-r--r--plugins/copyfile/copyfile.plugin.zsh5
-rw-r--r--plugins/django/django.plugin.zsh15
-rw-r--r--plugins/emoji-clock/emoji-clock.plugin.zsh29
-rw-r--r--plugins/encode64/encode64.plugin.zsh2
-rw-r--r--plugins/extract/extract.plugin.zsh2
-rw-r--r--plugins/fabric/_fab60
-rw-r--r--plugins/fabric/fabric.plugin.zsh1
-rw-r--r--plugins/fbterm/fbterm.plugin.zsh6
-rw-r--r--plugins/git-flow-avh/git-flow-avh.plugin.zsh416
-rw-r--r--plugins/git-remote-branch/git-remote-branch.plugin.zsh3
-rw-r--r--plugins/git/git.plugin.zsh6
-rw-r--r--plugins/gitfast/_git9
-rw-r--r--plugins/gitfast/git-completion.bash445
-rw-r--r--plugins/gitfast/git-prompt.sh149
-rw-r--r--plugins/gitfast/gitfast.plugin.zsh3
-rw-r--r--plugins/github/github.plugin.zsh17
-rw-r--r--plugins/golang/golang.plugin.zsh150
-rw-r--r--plugins/gradle/gradle.plugin.zsh19
-rwxr-xr-xplugins/grails/grails.plugin.zsh28
-rw-r--r--plugins/knife/_knife29
-rw-r--r--plugins/last-working-dir/last-working-dir.plugin.zsh3
-rw-r--r--plugins/mercurial/mercurial.plugin.zsh6
-rw-r--r--plugins/mvn/mvn.plugin.zsh4
-rw-r--r--plugins/osx/osx.plugin.zsh3
-rw-r--r--plugins/phing/phing.plugin.zsh11
-rw-r--r--plugins/powify/_powify55
-rw-r--r--plugins/profiles/profiles.plugin.zsh12
-rw-r--r--plugins/rails/rails.plugin.zsh3
-rw-r--r--plugins/rails3/rails3.plugin.zsh3
-rw-r--r--plugins/rbenv/rbenv.plugin.zsh2
-rw-r--r--plugins/rebar/_rebar79
-rw-r--r--plugins/rvm/rvm.plugin.zsh16
-rw-r--r--plugins/safe-paste/safe-paste.plugin.zsh54
-rw-r--r--plugins/sbt/_sbt55
-rw-r--r--plugins/sbt/sbt.plugin.zsh23
-rw-r--r--plugins/scala/_scala249
-rw-r--r--plugins/ssh-agent/ssh-agent.plugin.zsh15
-rwxr-xr-xplugins/sublime/sublime.plugin.zsh26
-rw-r--r--plugins/symfony2/symfony2.plugin.zsh6
-rw-r--r--plugins/tmux/tmux.extra.conf2
-rw-r--r--plugins/tmux/tmux.only.conf1
-rw-r--r--plugins/tmux/tmux.plugin.zsh85
-rw-r--r--plugins/tmuxinator/_tmuxinator36
-rw-r--r--plugins/torrent/torrent.plugin.zsh17
-rw-r--r--plugins/vagrant/_vagrant7
-rw-r--r--plugins/vundle/vundle.plugin.zsh6
-rw-r--r--plugins/zeus/_zeus34
-rw-r--r--plugins/zeus/zeus.plugin.zsh6
62 files changed, 2229 insertions, 220 deletions
diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh
index 691d4d2db..45f2b06eb 100644
--- a/plugins/ant/ant.plugin.zsh
+++ b/plugins/ant/ant.plugin.zsh
@@ -1,17 +1,7 @@
-stat -f%m . > /dev/null 2>&1
-if [ "$?" = 0 ]; then
- stat_cmd=(stat -f%m)
-else
- stat_cmd=(stat -L --format=%Y)
-fi
-
_ant_does_target_list_need_generating () {
- if [ ! -f .ant_targets ]; then return 0;
- else
- accurate=$($stat_cmd .ant_targets)
- changed=$($stat_cmd build.xml)
- return $(expr $accurate '>=' $changed)
- fi
+ [ ! -f .ant_targets ] && return 0;
+ [ .ant_targets -nt build.xml ] && return 0;
+ return 1;
}
_ant () {
diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh
index ae92a0b4c..bffe9657a 100644
--- a/plugins/archlinux/archlinux.plugin.zsh
+++ b/plugins/archlinux/archlinux.plugin.zsh
@@ -8,7 +8,7 @@ if [[ -x `which yaourt` ]]; then
}
alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
- alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
+ alias 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
@@ -18,6 +18,8 @@ if [[ -x `which yaourt` ]]; then
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
diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh
index 95f890632..66bf46d13 100644
--- a/plugins/battery/battery.plugin.zsh
+++ b/plugins/battery/battery.plugin.zsh
@@ -10,12 +10,16 @@
if [[ $(uname) == "Darwin" ]] ; then
+ function battery_pct() {
+ typeset -F maxcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
+ typeset -F currentcapacity=$(ioreg -rc "AppleSmartBattery"| 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
- typeset -F maxcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
- typeset -F currentcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //')
- integer i=$(((currentcapacity/maxcapacity) * 100))
- echo $i
+ battery_pct
else
echo "External Power"
fi
@@ -42,17 +46,27 @@ if [[ $(uname) == "Darwin" ]] ; then
fi
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
else
- echo ""
+ echo "∞"
fi
}
elif [[ $(uname) == "Linux" ]] ; then
- if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
- function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" }
- function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') }
- function battery_pct_prompt() {
- b=$(battery_pct_remaining)
+ 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
@@ -61,11 +75,8 @@ elif [[ $(uname) == "Linux" ]] ; then
color='red'
fi
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
- }
- else
- error_msg='no battery'
- function battery_pct_remaining() { echo $error_msg }
- function battery_time_remaining() { echo $error_msg }
- function battery_pct_prompt() { echo '' }
- fi
+ else
+ echo "∞"
+ fi
+ }
fi
diff --git a/plugins/bower/_bower b/plugins/bower/_bower
new file mode 100755
index 000000000..ae0ca4a4e
--- /dev/null
+++ b/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/plugins/bower/bower.plugin.zsh b/plugins/bower/bower.plugin.zsh
new file mode 100644
index 000000000..ed9c04840
--- /dev/null
+++ b/plugins/bower/bower.plugin.zsh
@@ -0,0 +1,38 @@
+alias bi="bower install"
+alias bl="bower list"
+alias bs="bower search"
+
+bower_package_list=''
+
+_bower ()
+{
+ local curcontext="$curcontext" state line
+ typeset -A opt_args
+
+ _arguments -C \
+ ':command:->command' \
+ '*::options:->options'
+
+ case $state in
+ (command)
+
+ local -a subcommands
+ subcommands=(${=$(bower help | grep help | sed -e 's/,//g')})
+ _describe -t commands 'bower' subcommands
+ ;;
+
+ (options)
+ case $line[1] in
+
+ (install)
+ if [ -z "$bower_package_list" ];then
+ bower_package_list=$(bower search | awk 'NR > 2' | cut -d '-' -f 2 | cut -d ' ' -f 2 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")
+ fi
+ compadd "$@" $(echo $bower_package_list)
+ ;;
+ esac
+ ;;
+ esac
+}
+
+compdef _bower bower
diff --git a/plugins/bundler/_bundler b/plugins/bundler/_bundler
index 5d22cac9a..2ec3a5f9c 100644
--- a/plugins/bundler/_bundler
+++ b/plugins/bundler/_bundler
@@ -23,6 +23,7 @@ case $state in
"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
;;
@@ -62,6 +63,14 @@ case $state in
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
diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
index 10c221acd..a288cffcd 100644
--- a/plugins/bundler/bundler.plugin.zsh
+++ b/plugins/bundler/bundler.plugin.zsh
@@ -6,7 +6,7 @@ alias bu="bundle update"
# The following is based on https://github.com/gma/bundler-exec
-bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma zeus)
+bundled_commands=(annotate cap capify cucumber foreman guard jekyll middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma)
## Functions
diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/cake.plugin.zsh
index 1d0d196ee..44cc47470 100644
--- a/plugins/cake/cake.plugin.zsh
+++ b/plugins/cake/cake.plugin.zsh
@@ -14,12 +14,9 @@ _cake_does_target_list_need_generating () {
return 1;
fi
- if [ ! -f ${_cake_task_cache_file} ]; then return 0;
- else
- accurate=$(stat -f%m $_cake_task_cache_file)
- changed=$(stat -f%m Cakefile)
- return $(expr $accurate '>=' $changed)
- fi
+ [ ! -f ${_cake_task_cache_file} ] && return 0;
+ [ ${_cake_task_cache_file} -nt Cakefile ] && return 0;
+ return 1;
}
_cake () {
@@ -33,4 +30,4 @@ _cake () {
fi
}
-compdef _cake cake \ No newline at end of file
+compdef _cake cake
diff --git a/plugins/capistrano/_capistrano b/plugins/capistrano/_capistrano
index cf6b50c7f..1002dad96 100644
--- a/plugins/capistrano/_capistrano
+++ b/plugins/capistrano/_capistrano
@@ -1,7 +1,7 @@
#compdef cap
#autoload
-if [ -f config/deploy.rb ]; then
+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 --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~
diff --git a/plugins/colored-man/colored-man.plugin.zsh b/plugins/colored-man/colored-man.plugin.zsh
new file mode 100644
index 000000000..56056284a
--- /dev/null
+++ b/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/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh
new file mode 100644
index 000000000..0696607d9
--- /dev/null
+++ b/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/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh
index 567da1b45..f3d7ec2df 100644
--- a/plugins/command-not-found/command-not-found.plugin.zsh
+++ b/plugins/command-not-found/command-not-found.plugin.zsh
@@ -3,3 +3,7 @@
# 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/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh
index c9b762d07..2d1557541 100644
--- a/plugins/composer/composer.plugin.zsh
+++ b/plugins/composer/composer.plugin.zsh
@@ -13,6 +13,8 @@ _composer_get_command_list () {
_composer () {
if [ -f composer.json ]; then
compadd `_composer_get_command_list`
+ else
+ compadd create-project init search selfupdate show
fi
}
@@ -24,6 +26,7 @@ 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' \ No newline at end of file
+alias cget='curl -s https://getcomposer.org/installer | php'
diff --git a/plugins/copydir/copydir.plugin.zsh b/plugins/copydir/copydir.plugin.zsh
new file mode 100644
index 000000000..37bb5e086
--- /dev/null
+++ b/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/plugins/copyfile/copyfile.plugin.zsh b/plugins/copyfile/copyfile.plugin.zsh
new file mode 100644
index 000000000..944a903c6
--- /dev/null
+++ b/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/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh
index 0bbd031fe..9d898edca 100644
--- a/plugins/django/django.plugin.zsh
+++ b/plugins/django/django.plugin.zsh
@@ -20,6 +20,19 @@ _managepy-createcachetable(){
$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
@@ -163,6 +176,7 @@ _managepy-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.'
@@ -220,4 +234,5 @@ _managepy() {
compdef _managepy manage.py
compdef _managepy django
+compdef _managepy django-admin.py
compdef _managepy django-manage
diff --git a/plugins/emoji-clock/emoji-clock.plugin.zsh b/plugins/emoji-clock/emoji-clock.plugin.zsh
new file mode 100644
index 000000000..7351a02ec
--- /dev/null
+++ b/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/plugins/encode64/encode64.plugin.zsh b/plugins/encode64/encode64.plugin.zsh
index 3b59447c5..4dbd1b453 100644
--- a/plugins/encode64/encode64.plugin.zsh
+++ b/plugins/encode64/encode64.plugin.zsh
@@ -1,4 +1,4 @@
encode64(){ echo -n $1 | base64 }
-decode64(){ echo -n $1 | base64 -D }
+decode64(){ echo -n $1 | base64 --decode }
alias e64=encode64
alias d64=decode64
diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
index 5c125e98b..23e86c593 100644
--- a/plugins/extract/extract.plugin.zsh
+++ b/plugins/extract/extract.plugin.zsh
@@ -53,7 +53,7 @@ function extract() {
(*.lzma) unlzma "$1" ;;
(*.Z) uncompress "$1" ;;
(*.zip) unzip "$1" -d $extract_dir ;;
- (*.rar) unrar e -ad "$1" ;;
+ (*.rar) unrar x -ad "$1" ;;
(*.7z) 7za x "$1" ;;
(*.deb)
mkdir -p "$extract_dir/control"
diff --git a/plugins/fabric/_fab b/plugins/fabric/_fab
new file mode 100644
index 000000000..9628e1224
--- /dev/null
+++ b/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/plugins/fabric/fabric.plugin.zsh b/plugins/fabric/fabric.plugin.zsh
new file mode 100644
index 000000000..aca411329
--- /dev/null
+++ b/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/plugins/fbterm/fbterm.plugin.zsh b/plugins/fbterm/fbterm.plugin.zsh
new file mode 100644
index 000000000..4f0456016
--- /dev/null
+++ b/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/plugins/git-flow-avh/git-flow-avh.plugin.zsh b/plugins/git-flow-avh/git-flow-avh.plugin.zsh
new file mode 100644
index 000000000..d76f55ef6
--- /dev/null
+++ b/plugins/git-flow-avh/git-flow-avh.plugin.zsh
@@ -0,0 +1,416 @@
+#!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.'
+ )
+ _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.'
+ 'delet: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/plugins/git-remote-branch/git-remote-branch.plugin.zsh b/plugins/git-remote-branch/git-remote-branch.plugin.zsh
index ff98cbf87..6c5ab8f70 100644
--- a/plugins/git-remote-branch/git-remote-branch.plugin.zsh
+++ b/plugins/git-remote-branch/git-remote-branch.plugin.zsh
@@ -6,7 +6,8 @@ _git_remote_branch() {
compadd create publish rename delete track
elif (( CURRENT == 3 )); then
# second arg: remote branch name
- compadd `git branch -r | grep -v HEAD | sed "s/.*\///" | sed "s/ //g"`
+ 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`
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index 154aa6db1..15f901f86 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -14,8 +14,12 @@ 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 gca=git-commit
+compdef _git gc=git-commit
+alias gca!='git commit -v -a --amend'
+compdef _git gca!=git-commit
alias gco='git checkout'
compdef _git gco=git-checkout
alias gcm='git checkout master'
diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git
index 45775021f..cf8116d47 100644
--- a/plugins/gitfast/_git
+++ b/plugins/gitfast/_git
@@ -60,6 +60,15 @@ __gitcomp_nl ()
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
diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash
index be800e09b..93eba4675 100644
--- a/plugins/gitfast/git-completion.bash
+++ b/plugins/gitfast/git-completion.bash
@@ -13,6 +13,7 @@
# *) .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:
@@ -23,10 +24,6 @@
# 3) Consider changing your PS1 to also show the current branch,
# see git-prompt.sh for details.
-if [[ -n ${ZSH_VERSION-} ]]; then
- autoload -U +X bashcompinit && bashcompinit
-fi
-
case "$COMP_WORDBREAKS" in
*:*) : great ;;
*) COMP_WORDBREAKS="$COMP_WORDBREAKS:"
@@ -169,7 +166,6 @@ __git_reassemble_comp_words_by_ref()
}
if ! type _get_comp_words_by_ref >/dev/null 2>&1; then
-if [[ -z ${ZSH_VERSION:+set} ]]; then
_get_comp_words_by_ref ()
{
local exclude cur_ words_ cword_
@@ -197,32 +193,6 @@ _get_comp_words_by_ref ()
shift
done
}
-else
-_get_comp_words_by_ref ()
-{
- while [ $# -gt 0 ]; do
- case "$1" in
- cur)
- cur=${COMP_WORDS[COMP_CWORD]}
- ;;
- prev)
- prev=${COMP_WORDS[COMP_CWORD-1]}
- ;;
- words)
- words=("${COMP_WORDS[@]}")
- ;;
- cword)
- cword=$COMP_CWORD
- ;;
- -n)
- # assume COMP_WORDBREAKS is already set sanely
- shift
- ;;
- esac
- shift
- done
-}
-fi
fi
# Generates completion reply with compgen, appending a space to possible
@@ -264,6 +234,124 @@ __gitcomp_nl ()
COMPREPLY=($(compgen -P "${2-}" -S "${4- }" -W "$1" -- "${3-$cur}"))
}
+# 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.
+ COMPREPLY=($(compgen -P "${2-}" -W "$1" -- "${3-$cur}"))
+
+ # Tell Bash that compspec generates filenames.
+ compopt -o filenames 2>/dev/null
+}
+
+__git_index_file_list_filter_compat ()
+{
+ local path
+
+ while read -r path; do
+ case "$path" in
+ ?*/*) echo "${path%%/*}/" ;;
+ *) echo "$path" ;;
+ esac
+ done
+}
+
+__git_index_file_list_filter_bash ()
+{
+ local path
+
+ while read -r path; do
+ case "$path" in
+ ?*/*)
+ # XXX if we append a slash to directory names when using
+ # `compopt -o filenames`, Bash will append another slash.
+ # This is pretty stupid, and this the reason why we have to
+ # define a compatible version for this function.
+ echo "${path%%/*}" ;;
+ *)
+ echo "$path" ;;
+ esac
+ done
+}
+
+# Process path list returned by "ls-files" and "diff-index --name-only"
+# commands, in order to list only file names relative to a specified
+# directory, and append a slash to directory names.
+__git_index_file_list_filter ()
+{
+ # Default to Bash >= 4.x
+ __git_index_file_list_filter_bash
+}
+
+# Execute git ls-files, returning 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
+ # NOTE: $2 is not quoted in order to support multiple options
+ cd "$1" && git ls-files --exclude-standard $2
+ ) 2>/dev/null
+}
+
+
+# Execute git diff-index, returning paths relative to the directory
+# specified in the first argument, and using the tree object id
+# specified in the second argument.
+__git_diff_index_helper ()
+{
+ (
+ test -n "${CDPATH+set}" && unset CDPATH
+ cd "$1" && git diff-index --name-only --relative "$2"
+ ) 2>/dev/null
+}
+
+# __git_index_files accepts 1 or 2 arguments:
+# 1: Options to pass to ls-files (required).
+# Supported options are --cached, --modified, --deleted, --others,
+# and --directory.
+# 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-.}"
+
+ if [ -d "$dir" ]; then
+ __git_ls_files_helper "$root" "$1" | __git_index_file_list_filter |
+ sort | uniq
+ fi
+}
+
+# __git_diff_index_files accepts 1 or 2 arguments:
+# 1) The id of a tree object.
+# 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_diff_index_files ()
+{
+ local dir="$(__gitdir)" root="${2-.}"
+
+ if [ -d "$dir" ]; then
+ __git_diff_index_helper "$root" "$1" | __git_index_file_list_filter |
+ sort | uniq
+ fi
+}
+
__git_heads ()
{
local dir="$(__gitdir)"
@@ -321,7 +409,7 @@ __git_refs ()
if [[ "$ref" == "$cur"* ]]; then
echo "$ref"
fi
- done | uniq -u
+ done | sort | uniq -u
fi
return
fi
@@ -428,7 +516,7 @@ __git_complete_revlist_file ()
*) pfx="$ref:$pfx" ;;
esac
- __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
+ __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" 2>/dev/null \
| sed '/^100... blob /{
s,^.* ,,
s,$, ,
@@ -461,6 +549,46 @@ __git_complete_revlist_file ()
}
+# __git_complete_index_file requires 1 argument: the options to pass to
+# ls-file
+__git_complete_index_file ()
+{
+ local pfx cur_="$cur"
+
+ case "$cur_" in
+ ?*/*)
+ pfx="${cur_%/*}"
+ cur_="${cur_##*/}"
+ pfx="${pfx}/"
+
+ __gitcomp_file "$(__git_index_files "$1" "$pfx")" "$pfx" "$cur_"
+ ;;
+ *)
+ __gitcomp_file "$(__git_index_files "$1")" "" "$cur_"
+ ;;
+ esac
+}
+
+# __git_complete_diff_index_file requires 1 argument: the id of a tree
+# object
+__git_complete_diff_index_file ()
+{
+ local pfx cur_="$cur"
+
+ case "$cur_" in
+ ?*/*)
+ pfx="${cur_%/*}"
+ cur_="${cur_##*/}"
+ pfx="${pfx}/"
+
+ __gitcomp_file "$(__git_diff_index_files "$1" "$pfx")" "$pfx" "$cur_"
+ ;;
+ *)
+ __gitcomp_file "$(__git_diff_index_files "$1")" "" "$cur_"
+ ;;
+ esac
+}
+
__git_complete_file ()
{
__git_complete_revlist_file
@@ -562,10 +690,19 @@ __git_complete_strategy ()
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 help -a|egrep '^ [a-zA-Z0-9]')
+ for i in $(__git_commands)
do
case $i in
*--*) : helper pattern;;
@@ -585,7 +722,7 @@ __git_list_porcelain_commands ()
{
local i IFS=" "$'\n'
__git_compute_all_commands
- for i in "help" $__git_all_commands
+ for i in $__git_all_commands
do
case $i in
*--*) : helper pattern;;
@@ -594,6 +731,7 @@ __git_list_porcelain_commands ()
archimport) : import;;
cat-file) : plumbing;;
check-attr) : plumbing;;
+ check-ignore) : plumbing;;
check-ref-format) : plumbing;;
checkout-index) : plumbing;;
commit-tree) : plumbing;;
@@ -753,6 +891,43 @@ __git_has_doubledash ()
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 ()
@@ -801,8 +976,6 @@ _git_apply ()
_git_add ()
{
- __git_has_doubledash && return
-
case "$cur" in
--*)
__gitcomp "
@@ -811,7 +984,9 @@ _git_add ()
"
return
esac
- COMPREPLY=()
+
+ # XXX should we check for --update and --all options ?
+ __git_complete_index_file "--others --modified"
}
_git_archive ()
@@ -961,15 +1136,15 @@ _git_cherry_pick ()
_git_clean ()
{
- __git_has_doubledash && return
-
case "$cur" in
--*)
__gitcomp "--dry-run --quiet"
return
;;
esac
- COMPREPLY=()
+
+ # XXX should we check for -x option ?
+ __git_complete_index_file "--others"
}
_git_clone ()
@@ -989,6 +1164,8 @@ _git_clone ()
--upload-pack
--template=
--depth
+ --single-branch
+ --branch
"
return
;;
@@ -998,7 +1175,19 @@ _git_clone ()
_git_commit ()
{
- __git_has_doubledash && return
+ case "$prev" in
+ -c|-C)
+ __gitcomp_nl "$(__git_refs)" "" "${cur}"
+ return
+ ;;
+ esac
+
+ case "$prev" in
+ -c|-C)
+ __gitcomp_nl "$(__git_refs)" "" "${cur}"
+ return
+ ;;
+ esac
case "$cur" in
--cleanup=*)
@@ -1027,7 +1216,13 @@ _git_commit ()
"
return
esac
- COMPREPLY=()
+
+ if git rev-parse --verify --quiet HEAD >/dev/null; then
+ __git_complete_diff_index_file "HEAD"
+ else
+ # This is the first commit
+ __git_complete_index_file "--cached"
+ fi
}
_git_describe ()
@@ -1043,6 +1238,8 @@ _git_describe ()
__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
@@ -1053,10 +1250,11 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
--no-ext-diff
--no-prefix --src-prefix= --dst-prefix=
--inter-hunk-context=
- --patience
+ --patience --histogram --minimal
--raw
--dirstat --dirstat= --dirstat-by-file
--dirstat-by-file= --cumulative
+ --diff-algorithm=
"
_git_diff ()
@@ -1064,6 +1262,10 @@ _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
@@ -1116,6 +1318,14 @@ _git_fetch ()
__git_complete_remote_or_refspec
}
+__git_format_patch_options="
+ --stdout --attach --no-attach --thread --thread= --output-directory
+ --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=
+"
+
_git_format_patch ()
{
case "$cur" in
@@ -1126,21 +1336,7 @@ _git_format_patch ()
return
;;
--*)
- __gitcomp "
- --stdout --attach --no-attach --thread --thread=
- --output-directory
- --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=
- "
+ __gitcomp "$__git_format_patch_options"
return
;;
esac
@@ -1251,8 +1447,6 @@ _git_init ()
_git_ls_files ()
{
- __git_has_doubledash && return
-
case "$cur" in
--*)
__gitcomp "--cached --deleted --modified --others --ignored
@@ -1265,7 +1459,10 @@ _git_ls_files ()
return
;;
esac
- COMPREPLY=()
+
+ # XXX ignore options like --modified and always suggest all cached
+ # files.
+ __git_complete_index_file "--cached"
}
_git_ls_remote ()
@@ -1397,7 +1594,14 @@ _git_mv ()
return
;;
esac
- COMPREPLY=()
+
+ 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 ()
@@ -1554,6 +1758,12 @@ _git_send_email ()
__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
@@ -1563,11 +1773,12 @@ _git_send_email ()
--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"
+ --validate --no-validate
+ $__git_format_patch_options"
return
;;
esac
- COMPREPLY=()
+ __git_complete_revlist
}
_git_stage ()
@@ -1581,7 +1792,7 @@ __git_config_get_set_variables ()
while [ $c -gt 1 ]; do
word="${words[c]}"
case "$word" in
- --global|--system|--file=*)
+ --system|--global|--local|--file=*)
config_file="$word"
break
;;
@@ -1687,7 +1898,7 @@ _git_config ()
case "$cur" in
--*)
__gitcomp "
- --global --system --file=
+ --system --global --local --file=
--list --replace-all
--get --get-all --get-regexp
--add --unset --unset-all
@@ -1860,6 +2071,7 @@ _git_config ()
diff.suppressBlankEmpty
diff.tool
diff.wordRegex
+ diff.algorithm
difftool.
difftool.prompt
fetch.recurseSubmodules
@@ -2096,15 +2308,14 @@ _git_revert ()
_git_rm ()
{
- __git_has_doubledash && return
-
case "$cur" in
--*)
__gitcomp "--cached --dry-run --ignore-unmatch --quiet"
return
;;
esac
- COMPREPLY=()
+
+ __git_complete_index_file "--cached"
}
_git_shortlog ()
@@ -2134,6 +2345,10 @@ _git_show ()
" "" "${cur#*=}"
return
;;
+ --diff-algorithm=*)
+ __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
+ return
+ ;;
--*)
__gitcomp "--pretty= --format= --abbrev-commit --oneline
$__git_diff_common_options
@@ -2429,20 +2644,88 @@ __gitk_main ()
__git_complete_revlist
}
-__git_func_wrap ()
-{
- if [[ -n ${ZSH_VERSION-} ]]; then
- emulate -L bash
- setopt KSH_TYPESET
+if [[ -n ${ZSH_VERSION-} ]]; then
+ echo "WARNING: this script is deprecated, please see git-completion.zsh" 1>&2
- # workaround zsh's bug that leaves 'words' as a special
- # variable in versions < 4.3.12
- typeset -h words
+ autoload -U +X compinit && compinit
- # workaround zsh's bug that quotes spaces in the COMPREPLY
- # array if IFS doesn't contain spaces.
- typeset -h IFS
+ __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_zsh_helper ()
+ {
+ emulate -L ksh
+ local cur cword prev
+ cur=${words[CURRENT-1]}
+ prev=${words[CURRENT-2]}
+ let cword=CURRENT-1
+ __${service}_main
+ }
+
+ _git ()
+ {
+ emulate -L zsh
+ local _ret=1
+ __git_zsh_helper
+ let _ret && _default -S '' && _ret=0
+ return _ret
+ }
+
+ compdef _git git gitk
+ return
+elif [[ -n ${BASH_VERSION-} ]]; then
+ if ((${BASH_VERSINFO[0]} < 4)); then
+ # compopt is not supported
+ __git_index_file_list_filter ()
+ {
+ __git_index_file_list_filter_compat
+ }
fi
+fi
+
+__git_func_wrap ()
+{
local cur words cword prev
_get_comp_words_by_ref -n =: cur words cword prev
$1
diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh
index bf20491ec..65f8368f1 100644
--- a/plugins/gitfast/git-prompt.sh
+++ b/plugins/gitfast/git-prompt.sh
@@ -10,9 +10,22 @@
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
# 2) Add the following line to your .bashrc/.zshrc:
# source ~/.git-prompt.sh
-# 3) Change your PS1 to also show the current branch:
-# Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
-# ZSH: PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ '
+# 3a) Change your PS1 to call __git_ps1 as
+# command-substitution:
+# Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
+# ZSH: PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ '
+# the optional argument will be used as format string.
+# 3b) Alternatively, if you are using bash, __git_ps1 can be
+# used for PROMPT_COMMAND with two parameters, <pre> and
+# <post>, which are strings you would put in $PS1 before
+# and after the status string generated by the git-prompt
+# machinery. e.g.
+# 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.
+# Optionally, you can supply a third argument with a printf
+# format string to finetune the output of the branch status
#
# The argument to __git_ps1 will be displayed only if you are currently
# in a git repository. The %s token will be the name of the current
@@ -30,7 +43,10 @@
#
# 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.
+# 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, ">"
@@ -49,6 +65,19 @@
# 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".
# __gitdir accepts 0 or 1 arguments (i.e., location)
# returns location of .git repo
@@ -195,11 +224,43 @@ __git_ps1_show_upstream ()
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
-# returns text to add to bash PS1 prompt (includes branch name)
+# 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 g="$(__gitdir)"
- if [ -n "$g" ]; then
+ if [ -z "$g" ]; then
+ if [ $pcmode = yes ]; then
+ #In PC mode PS1 always needs to be set
+ PS1="$ps1pc_start$ps1pc_end"
+ fi
+ else
local r=""
local b=""
if [ -f "$g/rebase-merge/interactive" ]; then
@@ -226,7 +287,7 @@ __git_ps1 ()
fi
b="$(git symbolic-ref HEAD 2>/dev/null)" || {
-
+ detached=yes
b="$(
case "${GIT_PS1_DESCRIBE_STYLE-}" in
(contains)
@@ -259,24 +320,25 @@ __git_ps1 ()
b="GIT_DIR!"
fi
elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
- if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
- if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
- git diff --no-ext-diff --quiet --exit-code || w="*"
- if git rev-parse --quiet --verify HEAD >/dev/null; then
- git diff-index --cached --quiet HEAD -- || i="+"
- else
- i="#"
- fi
+ if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] &&
+ [ "$(git config --bool bash.showDirtyState)" != "false" ]
+ then
+ git diff --no-ext-diff --quiet --exit-code || w="*"
+ if git rev-parse --quiet --verify HEAD >/dev/null; then
+ git diff-index --cached --quiet HEAD -- || i="+"
+ else
+ i="#"
fi
fi
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then
git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$"
fi
- if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
- if [ -n "$(git ls-files --others --exclude-standard)" ]; then
- u="%"
- fi
+ if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
+ [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
+ [ -n "$(git ls-files --others --exclude-standard)" ]
+ then
+ u="%%"
fi
if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then
@@ -285,6 +347,53 @@ __git_ps1 ()
fi
local f="$w$i$s$u"
- printf -- "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r$p"
+ if [ $pcmode = yes ]; then
+ local gitstring=
+ if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
+ local c_red='\e[31m'
+ local c_green='\e[32m'
+ local c_lblue='\e[1;34m'
+ local c_clear='\e[0m'
+ local bad_color=$c_red
+ local ok_color=$c_green
+ local branch_color="$c_clear"
+ local flags_color="$c_lblue"
+ local branchstring="$c${b##refs/heads/}"
+
+ if [ $detached = no ]; then
+ branch_color="$ok_color"
+ else
+ branch_color="$bad_color"
+ fi
+
+ # Setting gitstring directly with \[ and \] around colors
+ # is necessary to prevent wrapping issues!
+ gitstring="\[$branch_color\]$branchstring\[$c_clear\]"
+
+ if [ -n "$w$i$s$u$r$p" ]; then
+ gitstring="$gitstring "
+ fi
+ if [ "$w" = "*" ]; then
+ gitstring="$gitstring\[$bad_color\]$w"
+ fi
+ if [ -n "$i" ]; then
+ gitstring="$gitstring\[$ok_color\]$i"
+ fi
+ if [ -n "$s" ]; then
+ gitstring="$gitstring\[$flags_color\]$s"
+ fi
+ if [ -n "$u" ]; then
+ gitstring="$gitstring\[$bad_color\]$u"
+ fi
+ gitstring="$gitstring\[$c_clear\]$r$p"
+ else
+ gitstring="$c${b##refs/heads/}${f:+ $f}$r$p"
+ fi
+ gitstring=$(printf -- "$printf_format" "$gitstring")
+ PS1="$ps1pc_start$gitstring$ps1pc_end"
+ else
+ # NO color option unless in PROMPT_COMMAND mode
+ printf -- "$printf_format" "$c${b##refs/heads/}${f:+ $f}$r$p"
+ fi
fi
}
diff --git a/plugins/gitfast/gitfast.plugin.zsh b/plugins/gitfast/gitfast.plugin.zsh
index 7e50cf721..dba1b1315 100644
--- a/plugins/gitfast/gitfast.plugin.zsh
+++ b/plugins/gitfast/gitfast.plugin.zsh
@@ -3,5 +3,6 @@ source $dir/../git/git.plugin.zsh
source $dir/git-prompt.sh
function git_prompt_info() {
- __git_ps1 "${ZSH_THEME_GIT_PROMPT_PREFIX//\%/%%}%s${ZSH_THEME_GIT_PROMPT_SUFFIX//\%/%%}"
+ dirty="$(parse_git_dirty)"
+ __git_ps1 "${ZSH_THEME_GIT_PROMPT_PREFIX//\%/%%}%s${dirty//\%/%%}${ZSH_THEME_GIT_PROMPT_SUFFIX//\%/%%}"
}
diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh
index 598b059c1..66a10cfdb 100644
--- a/plugins/github/github.plugin.zsh
+++ b/plugins/github/github.plugin.zsh
@@ -1,5 +1,22 @@
# 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
diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh
new file mode 100644
index 000000000..e60c4afe4
--- /dev/null
+++ b/plugins/golang/golang.plugin.zsh
@@ -0,0 +1,150 @@
+# From : http://golang.org/misc/zsh/go?m=text
+# 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]'
+ '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"
+ '-x[print the commands]'
+ "-work[print temporary directory name and keep it]"
+ "-gcflags[flags for 5g/6g/8g]:flags"
+ "-ldflags[flags for 5l/6l/8l]:flags"
+ "-gccgoflags[flags for gccgo]:flags"
+ )
+ __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" \
+ "-benchtime[run each benchmark during n seconds]:duration" \
+ "-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]' \
+ 'importpath[description of import paths]' \
+ '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 \ No newline at end of file
diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh
index fc4c78c50..9229512f7 100644
--- a/plugins/gradle/gradle.plugin.zsh
+++ b/plugins/gradle/gradle.plugin.zsh
@@ -54,27 +54,14 @@ function in_gradle() {
fi
}
-############################################################################
-# Define the stat_cmd command based on platform behavior
-##########################################################################
-stat -f%m . > /dev/null 2>&1
-if [ "$?" = 0 ]; then
- stat_cmd=(stat -f%m)
-else
- stat_cmd=(stat -L --format=%Y)
-fi
-
############################################################################## Examine the build.gradle file to see if its
# timestamp has changed, and if so, regen
# the .gradle_tasks cache file
############################################################################
_gradle_does_task_list_need_generating () {
- if [ ! -f .gradletasknamecache ]; then return 0;
- else
- accurate=$($stat_cmd .gradletasknamecache)
- changed=$($stat_cmd build.gradle)
- return $(expr $accurate '>=' $changed)
- fi
+ [ ! -f .gradletasknamecache ] && return 0;
+ [ .gradletasknamecache -nt build.gradle ] && return 0;
+ return 1;
}
diff --git a/plugins/grails/grails.plugin.zsh b/plugins/grails/grails.plugin.zsh
index cc6f9c53b..11777738c 100755
--- a/plugins/grails/grails.plugin.zsh
+++ b/plugins/grails/grails.plugin.zsh
@@ -24,17 +24,23 @@ _enumerateGrailsScripts() {
return
fi
- # - Strip the path
- # - Remove all scripts with a leading '_'
- # - PackagePlugin_.groovy -> PackagePlugin
- # - PackagePlugin -> Package-Plugin
- # - Package-Plugin -> package-plugin
- basename $files \
- | sed -E -e 's/^_?([^_]+)_?.groovy/\1/'\
- -e 's/([a-z])([A-Z])/\1-\2/g' \
- | tr "[:upper:]" "[:lower:]" \
- | sort \
- | uniq
+ 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() {
diff --git a/plugins/knife/_knife b/plugins/knife/_knife
index dec491257..b44283f78 100644
--- a/plugins/knife/_knife
+++ b/plugins/knife/_knife
@@ -1,5 +1,10 @@
#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 )
@@ -26,7 +31,7 @@ _knife() {
case $state in
knifecmd)
- compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec environment index node recipe role search ssh status windows $cloudproviders
+ 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
@@ -42,9 +47,12 @@ _knife() {
cookbook)
compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
;;
- environment)
+ 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"
;;
@@ -54,6 +62,9 @@ _knife() {
role)
compadd -Q "$@" "bulk delete" create delete edit "from file" list show
;;
+ upload)
+ _arguments '*:file or directory:_files -g "*"'
+ ;;
windows)
compadd "$@" bootstrap
;;
@@ -170,11 +181,13 @@ _chef_environments_remote() {
# 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="$HOME/.chef/knife.rb"
- if [ -f ./.chef/knife.rb ]; then
- knife_rb="./.chef/knife.rb"
- fi
- (for i in $( grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
+
+ 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
diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh
index 190bc279d..bc36c80db 100644
--- a/plugins/last-working-dir/last-working-dir.plugin.zsh
+++ b/plugins/last-working-dir/last-working-dir.plugin.zsh
@@ -9,7 +9,8 @@ local cache_file="$ZSH/cache/last-working-dir"
# Updates the last directory once directory is changed.
function chpwd() {
- echo "$PWD" > "$cache_file"
+ # Use >| in case noclobber is set to avoid "file exists" error
+ pwd >| "$cache_file"
}
# Changes directory to the last working directory.
diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh
index a3a6ff8b6..9aa2d167a 100644
--- a/plugins/mercurial/mercurial.plugin.zsh
+++ b/plugins/mercurial/mercurial.plugin.zsh
@@ -3,11 +3,15 @@
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'
# this is the 'git commit --amend' equivalent
@@ -17,4 +21,4 @@ function hg_current_branch() {
if [ -d .hg ]; then
echo hg:$(hg branch)
fi
-} \ No newline at end of file
+}
diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
index da29b4f0a..799f6fc8c 100644
--- a/plugins/mvn/mvn.plugin.zsh
+++ b/plugins/mvn/mvn.plugin.zsh
@@ -114,7 +114,7 @@ function listMavenCompletions {
# jboss
jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy
# tomcat
- tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:undeploy
+ 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
@@ -163,7 +163,7 @@ function listMavenCompletions {
cli:execute cli:execute-phase
archetype:generate generate-sources
cobertura:cobertura
- -Dtest= `if [ -d ./src ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`
+ -Dtest= `if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`
);
}
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
index f278d4f8d..51cd7c143 100644
--- a/plugins/osx/osx.plugin.zsh
+++ b/plugins/osx/osx.plugin.zsh
@@ -154,3 +154,6 @@ function trash() {
IFS=$temp_ifs
}
+function vncviewer() {
+ open vnc://$@
+}
diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh
index 8f4adca08..795f1db85 100644
--- a/plugins/phing/phing.plugin.zsh
+++ b/plugins/phing/phing.plugin.zsh
@@ -1,16 +1,13 @@
_phing_does_target_list_need_generating () {
- if [ ! -f .phing_targets ]; then return 0;
- else
- accurate=$(stat -f%m .phing_targets)
- changed=$(stat -f%m build.xml)
- return $(expr $accurate '>=' $changed)
- fi
+ [ ! -f .phing_targets ] && return 0;
+ [ .phing_targets -nt build.xml ] && return 0;
+ return 1;
}
_phing () {
if [ -f build.xml ]; then
if _phing_does_target_list_need_generating; then
- phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets
+ phing -l |grep -v ":$" |grep -v "^-*$" > .phing_targets
fi
compadd `cat .phing_targets`
fi
diff --git a/plugins/powify/_powify b/plugins/powify/_powify
new file mode 100644
index 000000000..d23c46513
--- /dev/null
+++ b/plugins/powify/_powify
@@ -0,0 +1,55 @@
+#compdef powify
+
+_powify_all_servers() {
+ all_servers=(`ls $HOME/.pow/`)
+}
+
+local -a all_servers
+
+local -a _1st_arguments
+_1st_arguments=(
+ 'server:server specific commands'
+ 'utils:manage powify'
+ 'create:creates a pow app from the current directory (to change the name append name as an argument)'
+ 'destroy:destroys the pow app linked to the current directory'
+ 'restart:restarts the pow app linked to the current directory'
+ 'always_restart:reload the pow app after each request'
+ 'always_restart_off:do not reload the pow app after each request'
+ 'rename:rename the current pow app to [NAME] or renmae [OLD] to [NEW]'
+ 'environment:run the this pow app in a different environment (aliased `env`)'
+ 'browse:opens and navigates the default browser to this app'
+ 'logs:tail the application logs'
+)
+
+_arguments '*:: :->command'
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "powify command" _1st_arguments
+ return
+fi
+
+case "$words[1]" in
+ server)
+ _values \
+ 'install[install pow server]' \
+ 'reinstall[reinstall pow server]' \
+ 'update[update pow server]' \
+ 'uninstall[uninstall pow server]' \
+ 'list[list all pow apps]' \
+ 'start[start the pow server]' \
+ 'stop[stop the pow server]' \
+ 'restart[restart the pow server]' \
+ 'host[adds all pow apps to /etc/hosts file]' \
+ 'unhost[removes all pow apps from /etc/hosts file]' \
+ 'status[print the current server status]' \
+ 'config[print the current server configuration]' \
+ 'logs[tails the pow server logs]' ;;
+ utils)
+ _values \
+ 'install[install powify.dev server management tool]' \
+ 'reinstall[reinstall powify.dev server management tool]' \
+ 'uninstall[uninstall powify.dev server management tool]' ;;
+ destroy|restart|always_restart|always_restart_off|rename|browse|logs)
+ _powify_all_servers
+ _wanted all_servers expl 'all pow servers' compadd -a all_servers ;;
+esac
diff --git a/plugins/profiles/profiles.plugin.zsh b/plugins/profiles/profiles.plugin.zsh
new file mode 100644
index 000000000..8faae6b53
--- /dev/null
+++ b/plugins/profiles/profiles.plugin.zsh
@@ -0,0 +1,12 @@
+# You will probably want to list this plugin as the first in your .zshrc.
+
+# This will look for a custom profile for the local machine and each domain or
+# subdomain it belongs to. (e.g. com, example.com and foo.example.com)
+parts=(${(s:.:)$(hostname)})
+for i in {${#parts}..1}; do
+ profile=${(j:.:)${parts[$i,${#parts}]}}
+ file=$ZSH_CUSTOM/profiles/$profile
+ if [ -f $file ]; then
+ source $file
+ fi
+done
diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh
index d3849b4f4..0139d22c3 100644
--- a/plugins/rails/rails.plugin.zsh
+++ b/plugins/rails/rails.plugin.zsh
@@ -10,6 +10,9 @@ alias migrate='rake db:migrate && rake db:test:prepare'
alias sc='ruby script/console'
alias sd='ruby script/server --debugger'
alias devlog='tail -f log/development.log'
+alias -g RET='RAILS_ENV=test'
+alias -g REP='RAILS_ENV=production'
+alias -g RED='RAILS_ENV=development'
function remote_console() {
/usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh
index 237d0594b..a2697872a 100644
--- a/plugins/rails3/rails3.plugin.zsh
+++ b/plugins/rails3/rails3.plugin.zsh
@@ -21,3 +21,6 @@ alias rsd='_rails_command server --debugger'
alias devlog='tail -f log/development.log'
alias rdm='rake db:migrate'
alias rdr='rake db:rollback'
+alias -g RET='RAILS_ENV=test'
+alias -g REP='RAILS_ENV=production'
+alias -g RED='RAILS_ENV=development'
diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh
index fb9df4bdd..78f76c3a3 100644
--- a/plugins/rbenv/rbenv.plugin.zsh
+++ b/plugins/rbenv/rbenv.plugin.zsh
@@ -17,7 +17,7 @@ for rbenvdir in "${rbenvdirs[@]}" ; do
FOUND_RBENV=1
export RBENV_ROOT=$rbenvdir
export PATH=${rbenvdir}/bin:$PATH
- eval "$(rbenv init - zsh)"
+ eval "$(rbenv init --no-rehash - zsh)"
alias rubies="rbenv versions"
alias gemsets="rbenv gemset list"
diff --git a/plugins/rebar/_rebar b/plugins/rebar/_rebar
new file mode 100644
index 000000000..7ac5a510c
--- /dev/null
+++ b/plugins/rebar/_rebar
@@ -0,0 +1,79 @@
+#compdef rebar
+
+local curcontext=$curcontext state ret=1
+typeset -ga _rebar_global_opts
+
+_rebar_global_opts=(
+ '(--help -h)'{--help,-h}'[Show the program options]'
+ '(--commands -c)'{--commands,-c}'[Show available commands]'
+ '(--version -V)'{--version,-V}'[Show version information]'
+ '(-vvv -vv -v)'--verbose+'[Verbosity level. Default: 0]:verbosity level:(0 1 2 3)'
+ '(-vvv)-v[Slightly more verbose output]'
+ '(-vvv)-vv[More verbose output]'
+ '(-v -vv)-vvv[Most verbose output]'
+ '(--force -f)'{--force,-f}'[Force]'
+ '-D+[Define compiler macro]'
+ '(--jobs -j)'{--jobs+,-j+}'[Number of concurrent workers a command may use. Default: 3]:workers:(1 2 3 4 5 6 7 8 9)'
+ '(--config -C)'{--config,-C}'[Rebar config file to use]:files:_files'
+ '(--profile -p)'{--profile,-p}'[Profile this run of rebar]'
+ '(--keep-going -k)'{--keep-going,-k}'[Keep running after a command fails]'
+)
+
+_rebar () {
+ _arguments -C $_rebar_global_opts \
+ '*::command and variable:->cmd_and_var' \
+ && return
+
+ case $state in
+ cmd_and_var)
+ _values -S = 'variables' \
+ 'clean[Clean]' \
+ 'compile[Compile sources]' \
+ 'create[Create skel based on template and vars]' \
+ 'create-app[Create simple app skel]' \
+ 'create-node[Create simple node skel]' \
+ 'list-template[List avaiavle templates]' \
+ 'doc[Generate Erlang program documentation]' \
+ 'check-deps[Display to be fetched dependencies]' \
+ 'get-deps[Fetch dependencies]' \
+ 'update-deps[Update fetched dependencies]' \
+ 'delete-deps[Delete fetched dependencies]' \
+ 'list-deps[List dependencies]' \
+ 'generate[Build release with reltool]' \
+ 'overlay[Run reltool overlays only]' \
+ 'generate-appups[Generate appup files]' \
+ 'generate-upgrade[Build an upgrade package]' \
+ 'eunit[Run eunit tests]' \
+ 'ct[Run common_test suites]' \
+ 'qc[Test QuickCheck properties]' \
+ 'xref[Run cross reference analysis]' \
+ 'help[Show the program options]' \
+ 'version[Show version information]' \
+ 'apps[Application names to process]:' \
+ 'case[Common Test case]:' \
+ 'dump_spec[Dump reltool spec]:' \
+ 'jobs[Number of workers]::workers:(0 1 2 3 4 5 6 7 8 9)' \
+ 'suites[Common Test suites]::suite name:_path_files -W "(src test)" -g "*.erl(:r)"' \
+ 'verbose[Verbosity level]::verbosity level:(0 1 2 3)' \
+ 'appid[Application id]:' \
+ 'previous_release[Previous release path]:' \
+ 'nodeid[Node id]:' \
+ 'root_dir[Reltool config root directory]::directory:_files -/' \
+ 'skip_deps[Skip deps]::flag:(true false)' \
+ 'skip_apps[Application names to not process]::flag:(true false)' \
+ 'template[Template name]:' \
+ 'template_dir[Template directory]::directory:_files -/' \
+ && ret=0
+ ;;
+ esac
+}
+
+_rebar
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 2
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: sw=2 ts=2 et filetype=sh
diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh
index 1ab800b0f..cdd0a7847 100644
--- a/plugins/rvm/rvm.plugin.zsh
+++ b/plugins/rvm/rvm.plugin.zsh
@@ -3,8 +3,9 @@ fpath=($rvm_path/scripts/zsh/Completion $fpath)
alias rubies='rvm list rubies'
alias gemsets='rvm gemset list'
-local ruby18='ruby-1.8.7-p334'
-local ruby19='ruby-1.9.3-p194'
+local ruby18='ruby-1.8.7-p371'
+local ruby19='ruby-1.9.3-p392'
+local ruby20='ruby-2.0.0-p0'
function rb18 {
if [ -z "$1" ]; then
@@ -28,6 +29,17 @@ function rb19 {
_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
compdef _rb19 rb19
+function rb20 {
+ if [ -z "$1" ]; then
+ rvm use "$ruby"
+ else
+ rvm use "$ruby20@$1"
+ fi
+}
+
+_rb20() {compadd `ls -1 $rvm_path/gems | grep "^$ruby20@" | sed -e "s/^$ruby20@//" | awk '{print $1}'`}
+compdef _rb20 rb20
+
function rvm-update {
rvm get head
rvm reload # TODO: Reload rvm completion?
diff --git a/plugins/safe-paste/safe-paste.plugin.zsh b/plugins/safe-paste/safe-paste.plugin.zsh
new file mode 100644
index 000000000..17c212c19
--- /dev/null
+++ b/plugins/safe-paste/safe-paste.plugin.zsh
@@ -0,0 +1,54 @@
+# Code from Mikael Magnusson: http://www.zsh.org/mla/users/2011/msg00367.html
+#
+# Requires xterm, urxvt, iTerm2 or any other terminal that supports bracketed
+# paste mode as documented: http://www.xfree86.org/current/ctlseqs.html
+
+# create a new keymap to use while pasting
+bindkey -N paste
+# make everything in this keymap call our custom widget
+bindkey -R -M paste "^@"-"\M-^?" paste-insert
+# these are the codes sent around the pasted text in bracketed
+# paste mode.
+# do the first one with both -M viins and -M vicmd in vi mode
+bindkey '^[[200~' _start_paste
+bindkey -M paste '^[[201~' _end_paste
+# insert newlines rather than carriage returns when pasting newlines
+bindkey -M paste -s '^M' '^J'
+
+zle -N _start_paste
+zle -N _end_paste
+zle -N zle-line-init _zle_line_init
+zle -N zle-line-finish _zle_line_finish
+zle -N paste-insert _paste_insert
+
+# switch the active keymap to paste mode
+function _start_paste() {
+ bindkey -A paste main
+}
+
+# go back to our normal keymap, and insert all the pasted text in the
+# command line. this has the nice effect of making the whole paste be
+# a single undo/redo event.
+function _end_paste() {
+#use bindkey -v here with vi mode probably. maybe you want to track
+#if you were in ins or cmd mode and restore the right one.
+ bindkey -e
+ LBUFFER+=$_paste_content
+ unset _paste_content
+}
+
+function _paste_insert() {
+ _paste_content+=$KEYS
+}
+
+function _zle_line_init() {
+ # Tell terminal to send escape codes around pastes.
+ [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color || $TERM = screen || $TERM = screen-256color ]] && printf '\e[?2004h'
+}
+
+function _zle_line_finish() {
+ # Tell it to stop when we leave zle, so pasting in other programs
+ # doesn't get the ^[[200~ codes around the pasted text.
+ [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color || $TERM = screen || $TERM = screen-256color ]] && printf '\e[?2004l'
+}
+
diff --git a/plugins/sbt/_sbt b/plugins/sbt/_sbt
new file mode 100644
index 000000000..91372aa72
--- /dev/null
+++ b/plugins/sbt/_sbt
@@ -0,0 +1,55 @@
+#compdef sbt
+#autoload
+
+local -a _sbt_commands
+_sbt_commands=(
+ 'clean:delete files produced by the build'
+ 'compile:compile sources'
+ 'console:start the Scala REPL with project classes on the classpath'
+ 'console-quick:start the Scala REPL with project deps on the classpath'
+ 'console-project:start the Scala REPL w/sbt+build-def on the classpath'
+ 'dist:generate distribution artifacts'
+ 'dist\:clean:clean distribution artifacts'
+ 'doc:generate API documentation'
+ 'gen-idea:generate Intellij Idea project files'
+ 'package:produce the main artifact, such as a binary jar'
+ 'package-doc:produce a doc artifact, such as a jar containing API docs'
+ 'package-src:produce a source artifact, such as a jar containing sources'
+ 'publish:publish artifacts to a repository'
+ 'publish-local:publish artifacts to the local repository'
+ 'run:run a main class'
+ 'run-main:run the main class selected by the first argument'
+ 'test:execute all tests'
+ 'test-only:execute the tests provided as arguments'
+ 'test-quick:execute previously failed tests'
+ 'update:resolve and optionally retrieve dependencies'
+)
+
+local expl
+
+_arguments \
+ '(-help)-h[prints an help message]' \
+ '(-h)-help[prints an help message]' \
+ '(-verbose)-v[this runner is chattier]' \
+ '(-v)-verbose[this runner is chattier]' \
+ '(-debug)-d[set sbt log level to debug]' \
+ '(-d)-debug[set sbt log level to debug]' \
+ '-no-colors[disable ANSI color codes]' \
+ '-sbt-create[start even if current dir contains no sbt project]' \
+ '-sbt-dir[path to global settings/plugins dir (default: ~/.sbt)]' \
+ '-sbt-boot[path to shared boot dir (default: ~/.sbt/boot)]' \
+ '-ivy[path to local Ivy repository (default: ~/.ivy2)]' \
+ '-mem[set memory options]' \
+ '-no-share[use all local caches; no sharing]' \
+ '-no-global[use global caches, but do not use global ~/.sbt dir]' \
+ '-jvm-debug[turn on JVM debugging, open at the given port]' \
+ '-batch[disable interactive mode]' \
+ '-sbt-version[use the specified version of sbt]' \
+ '-sbt-jar[use the specified jar as the sbt launcher]' \
+ '(-sbt-snapshot)-sbt-rc[use an RC version of sbt]' \
+ '(-sbt-rc)-sbt-snapshot[use a snapshot version of sbt]' \
+ '-java-home[alternate JAVA_HOME]' \
+ '*:: :->subcmds' && return 0
+
+_describe -t commands "sbt subcommand" _sbt_commands
+return
diff --git a/plugins/sbt/sbt.plugin.zsh b/plugins/sbt/sbt.plugin.zsh
new file mode 100644
index 000000000..203c691f5
--- /dev/null
+++ b/plugins/sbt/sbt.plugin.zsh
@@ -0,0 +1,23 @@
+# ------------------------------------------------------------------------------
+# FILE: sbt.plugin.zsh
+# DESCRIPTION: oh-my-zsh plugin file.
+# AUTHOR: Mirko Caserta (mirko.caserta@gmail.com)
+# VERSION: 1.0.2
+# ------------------------------------------------------------------------------
+
+# aliases - mnemonic: prefix is 'sb'
+alias sbc='sbt compile'
+alias sbco='sbt console'
+alias sbcq='sbt console-quick'
+alias sbcl='sbt clean'
+alias sbcp='sbt console-project'
+alias sbd='sbt doc'
+alias sbdc='sbt dist:clean'
+alias sbdi='sbt dist'
+alias sbgi='sbt gen-idea'
+alias sbp='sbt publish'
+alias sbpl='sbt publish-local'
+alias sbr='sbt run'
+alias sbrm='sbt run-main'
+alias sbu='sbt update'
+alias sbx='sbt test'
diff --git a/plugins/scala/_scala b/plugins/scala/_scala
new file mode 100644
index 000000000..c4ccb37d3
--- /dev/null
+++ b/plugins/scala/_scala
@@ -0,0 +1,249 @@
+#compdef scala scalac
+# ------------------------------------------------------------------------------
+# Copyright (c) 2012 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 scala and scalac (http://www.scala-lang.org/).
+#
+# ------------------------------------------------------------------------------
+# Authors
+# -------
+#
+# * Tony Sloane <inkytonik@gmail.com>
+#
+# ------------------------------------------------------------------------------
+
+typeset -A opt_args
+local context state line
+
+_scala_features () {
+ compadd "postfixOps" "reflectiveCalls" "implicitConversions" "higherKinds" \
+ "existentials" "experimental.macros" "_"
+}
+
+_scala_phases () {
+ compadd "parser" "namer" "packageobjects" "typer" "patmat" "superaccessors" \
+ "extmethods" "pickler" "refchecks" "selectiveanf" "selectivecps" "uncurry" \
+ "tailcalls" "specialize" "explicitouter" "erasure" "posterasure" "lazyvals" \
+ "lambdalift" "constructors" "flatten" "mixin" "cleanup" "icode" "inliner" \
+ "inlineExceptionHandlers" "closelim" "dce" "jvm" "terminal"
+}
+
+local -a shared_opts
+shared_opts=(
+ "-bootclasspath+[Override location of bootstrap class files]:bootstrap class directory:_files -/"
+ "-classpath+[Specify where to find user class files]:directory:_files -/"
+ "-D-[Pass -Dproperty=value directly to the runtime system]"
+ "-d+[Destination for generated classfiles]: directory or jar file:_files"
+ "-dependencyfile+[Set dependency tracking file]:dependency tracking file:_files"
+ "-deprecation[Emit warning and location for usages of deprecated APIs]"
+ "-encoding+[Specify character encoding used by source files]:encoding:"
+ "-explaintypes[Explain type errors in more detail]"
+ "-extdirs+[Override location of installed extensions]:extensions directory:_files -/"
+ "-g\:-[Set level of generated debugging info (default\: vars)]:debugging info level:(none source line vars notailcalls)"
+ "-help[Print a synopsis of standard options]"
+ "-J-[pass argument directly to Java runtime system]:JVM argument:"
+ "-javabootclasspath+[Override java boot classpath]:Java boot class path directory]:_files -/"
+ "-javaextdirs+[Override java extdirs classpath]:Java extdirs directory:_files -/"
+ "-language\:-[Enable one or more language features]:feature:_scala_features"
+ "-no-specialization[Ignore @specialize annotations]"
+ "-nobootcp[Do not use the boot classpath for the scala jars]"
+ "-nowarn[Generate no warnings]"
+ "-optimise[Generate faster bytecode by applying optimisations to the program]"
+ "-P\:-[Pass an option to a plugin (written plugin\:opt)]:plugin option:"
+ "-print[Print program with Scala-specific features removed]"
+ "-sourcepath+[Specify location(s) of source files]:source file directory:_files -/"
+ "-target\:-[Target platform for object files (default\: jvm-1.5)]:platform name:(jvm-1.5 msil)"
+ "-toolcp+[Add to the runner classpath]:directory:_files -/"
+ "-unchecked[Enable detailed unchecked (erasure) warnings]"
+ "-uniqid[Uniquely tag all identifiers in debugging output]"
+ "-usejavacp[Utilize the java.class.path in classpath resolution]"
+ "-verbose[Output messages about what the compiler is doing]"
+ "-version[Print product version and exit]"
+ "-X[Print a synopsis of advanced options]"
+ "-Y[Print a synopsis of private options]"
+)
+
+local -a X_opts
+X_opts=(
+ "-Xcheck-null[Warn upon selection of nullable reference]"
+ "-Xcheckinit[Wrap field accessors to throw an exception on uninitialized access]"
+ "-Xdisable-assertions[Generate no assertions or assumptions]"
+ "-Xelide-below+[Calls to @elidable methods are omitted if method priority is lower than integer argument]"
+ "-Xexperimental[Enable experimental extensions]"
+ "-Xfatal-warnings[Fail the compilation if there are any warnings]"
+ "-Xfull-lubs[Retains pre 2.10 behavior of less aggressive truncation of least upper bounds]"
+ "-Xfuture[Turn on future language features]"
+ "-Xgenerate-phase-graph+[Generate the phase graphs (outputs .dot files) to fileX.dot]:output file:_files"
+ "-Xlint[Enable recommended additional warnings]"
+ "-Xlog-free-terms[Print a message when reification creates a free term]"
+ "-Xlog-free-types[Print a message when reification resorts to generating a free type]"
+ "-Xlog-implicits[Show more detail on why some implicits are not applicable]"
+ "-Xlog-implicit-conversions[Print a message whenever an implicit conversion is inserted]"
+ "-Xlog-reflective-calls[Print a message when a reflective method call is generated]"
+ "-Xmacro-settings\:-[Custom settings for macros]:option"
+ "-Xmain-class+[Class for manifest's Main-Class entry (only useful with -d jar)]:path:"
+ "-Xmax-classfile-name+[Maximum filename length for generated classes]"
+ "-Xmigration[Warn about constructs whose behavior may have changed]"
+ "-Xno-forwarders[Do not generate static forwarders in mirror classes]"
+ "-Xno-patmat-analysis[Don't perform exhaustivity/unreachability analysis. Also, ignore @switch annotation]"
+ "-Xno-uescape[Disable handling of \u unicode escapes]"
+ "-Xnojline[Do not use JLine for editing]"
+ "-Xoldpatmat[Use the pre-2.10 pattern matcher. Otherwise, the 'virtualizing' pattern matcher is used in 2.10]"
+ "-Xprint\:-[Print out program after <phase>]:phase name:_scala_phases"
+ "-Xprint-icode\:-[Log internal icode to *.icode files after phase (default\: icode)]:phase name:_scala_phases"
+ "-Xprint-pos[Print tree positions, as offsets]"
+ "-Xprint-types[Print tree types (debugging option)]"
+ "-Xprompt[Display a prompt after each error (debugging option)]"
+ "-Xresident[Compiler stays resident: read source filenames from standard input]"
+ "-Xscript+[Treat the source file as a script and wrap it in a main method]:main object name"
+ "-Xshow-class+[Show internal representation of class]:class name"
+ "-Xshow-object+[Show internal representation of object]:object name"
+ "-Xshow-phases[Print a synopsis of compiler phases]"
+ "-Xsource-reader+[Specify a class name for a custom method of reading source files]:class name"
+ "-Xverify[Verify generic signatures in generated bytecode]"
+
+ "-Xassem-extdirs+[List of directories containing assemblies (requires -target:msil) (default\: lib)]:assembly directory:_files -/"
+ "-Xassem-name+[Name of the output assembly (requires -target:msil)]:assembly name:_files"
+ "-Xassem-path+[List of assemblies referenced by the program (requires -target:msil)]:assembly path:_files"
+ "-Xsourcedir+[Mirror source folder structure in output directory (requires -target:msil)]:source directory:_files -/"
+
+ "-Xplugin\:-[Load one or more plugins from file]:plugin file:_files"
+ "-Xpluginsdir+[Path to search compiler plugins]:plugin directory:_files -/"
+ "-Xplugin-list[Print a synopsis of loaded plugins]"
+ "-Xplugin-disable\:-[Disable the given plugin(s)]"
+ "-Xplugin-require\:-[Abort unless the given plugin(s) are available]"
+)
+
+local -a Y_opts
+Y_opts=(
+ "-Y[Print a synopsis of private options]"
+ "-Ybuild-manager-debug[Generate debug information for the Refined Build Manager compiler]"
+ "-Ybuilder-debug\:-[Compile using the specified build manager (default\: none)]:build manager:(none refined simple)"
+ "-Yclosure-elim[Perform closure elimination]"
+ "-Ycompact-trees[Use compact tree printer when displaying trees]"
+ "-Ydead-code[Perform dead code elimination]"
+ "-Ydependent-method-types[Allow dependent method types]"
+ "-Ydump-classes+[Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders)]:output directory:_files -/"
+ "-Yeta-expand-keeps-star[Eta-expand varargs methods to T* rather than Seq[T]. This is a temporary option to ease transition.]"
+ "-Ygen-javap+[Generate a parallel output directory of .javap files]:output directory:_files -/"
+ "-Yinfer-argument-types[Infer types for arguments of overriden methods]"
+ "-Yinline[Perform inlining when possible]"
+ "-Yinline-handlers[Perform exception handler inlining when possible]"
+ "-Yinline-warnings[Emit inlining warnings (normally surpressed due to high volume)]"
+ "-Yinvalidate+[Invalidate classpath entry before run]:classpath entry"
+ "-Ylinearizer\:-[Linearizer to use (default\: rpo)]:linearizer:(normal dfs rpo dump)"
+ "-Ylog-classpath[Output information about what classpath is being applied]"
+ "-Yno-adapted-args[Do not adapt an argument list (either by inserting unit or creating a tuple) to match the receiver]"
+ "-Ymacro-debug-lite[Trace essential macro-related activities]"
+ "-Ymacro-debug-verbose[Trace all macro-related activities: compilation, generation of synthetics, classloading, expansion, exceptions]"
+ "-Yno-completion[Disable tab-completion in the REPL]"
+ "-Yno-generic-signatures[Suppress generation of generic signatures for Java]"
+ "-Yno-imports[Compile without any implicit imports]"
+ "-Yno-predef[Compile without importing Predef]"
+ "-Yno-self-type-checks[Suppress check for self-type conformance among inherited members]"
+ "-Yno-squeeze[Disable creation of compact code in matching]"
+ "-Ynotnull[Enable (experimental and incomplete) scala.NotNull]"
+ "-Yoverride-objects[Allow member objects to be overridden]"
+ "-Yoverride-vars[Allow vars to be overridden]"
+ "-Ypmat-naive[Desugar matches as naively as possible]"
+ "-Ypresentation-delay+[Wait number of ms after typing before starting typechecking]"
+ "-Ypresentation-log+[Log presentation compiler events into file]:log file:_files"
+ "-Ypresentation-replay+[Replay presentation compiler events from file]:log file:_files"
+ "-Ypresentation-strict[Do not report type errors in sources with syntax errors]"
+ "-Ypresentation-verbose[Print information about presentation compiler tasks]"
+ "-Yprofile-class+[Specify name of profiler class]:profiler class name"
+ "-Yprofile-memory[Heap snapshot after compiler run (requires jgpagent on JVM -agentpath)]"
+ "-Yrangepos[Use range positions for syntax trees]"
+ "-Yrecursion+[Set recursion depth used when locking symbols]"
+ "-Yreify-copypaste[Dump the reified trees in copypasteable representation]"
+ "-Yrepl-sync[Do not use asynchronous code for REPL startup]"
+ "-Yresolve-term-conflict\:-[Resolve term conflicts (default\: error)]:resolution strategy:(package object error)"
+ "-Yself-in-annots[Include a \"self\" identifier inside of annotations]"
+ "-Yshow\:-[Show after <phase> (requires -Xshow-class or -Xshow-object)]:phase name:_scala_phases"
+ "-Yshow-syms[Print the AST symbol hierarchy after each phase]"
+ "-Yshow-symkinds[Print abbreviated symbol kinds next to symbol names]"
+ "-Yshow-trees[Print detailed ASTs (requires -Xprint\:phase)]"
+ "-Yshow-trees-compact[Print detailed ASTs in compact form (requires -Xprint\:)]"
+ "-Yshow-trees-stringified[Print stringifications along with detailed ASTs (requires -Xprint\:)]"
+ "-Ystatistics[Print compiler statistics]"
+ "-Ystruct-dispatch\:-[Structural method dispatch policy (default\: poly-cache)]:policy name:(no-cache mono-cache poly-cache invoke-dynamic)"
+
+ "-Ybrowse\:-[Browse the abstract syntax tree after <phase>]:phase name:_scala_phases"
+ "-Ycheck\:-[Check the tree at the end of <phase>]:phase name:_scala_phases"
+ "-Ylog\:-[Log operations during <phase>]:phase name:_scala_phases"
+ "-Yprofile\:-[Profile CPU usage of given phases (requires jgpagent on JVM -agentpath)]:phase name:_scala_phases"
+ "-Yskip\:-[Skip <phase>]:phase name:_scala_phases"
+ "-Ystop-after\:-[Stop after given phase <phase>]:phase name:_scala_phases"
+ "-Ystop-before\:-[Stop before given phase <phase>]:phase name:_scala_phases"
+
+ "-Ywarn-adapted-args[Warn if an argument list is modified to match the receiver]"
+ "-Ywarn-all[Enable all -Y warnings]"
+ "-Ywarn-dead-code[Warn when dead code is identified]"
+ "-Ywarn-inaccessible[Warn about inaccessible types in method signatures]"
+ "-Ywarn-nullary-override[Warn when non-nullary overrides nullary, e.g. def foo() over def foo]"
+ "-Ywarn-nullary-unit[Warn when nullary methods return Unit]"
+ "-Ywarn-numeric-widen[Warn when numerics are widened]"
+ "-Ywarn-value-discard[Warn when non-Unit expression results are unused]"
+
+ "-Ybuild-manager-debug[Generate debug information for the Refined Build Manager compiler]"
+ "-Ybuilder-debug\:-[Compile using the specified build manager (default\: none)]:manager:(none refined simple)"
+ "-Ycompletion-debug[Trace all tab completion activity]"
+ "-Ydebug[Increase the quantity of debugging output]"
+ "-Ydoc-debug[Trace all scaladoc activity]"
+ "-Yide-debug[Generate, validate and output trees using the interactive compiler]"
+ "-Yinfer-debug[Trace type inference and implicit search]"
+ "-Yissue-debug[Print stack traces when a context issues an error]"
+ "-Ypatmat-debug[Trace pattern matching translation]"
+ "-Ypmat-debug[Trace all pattern matcher activity]"
+ "-Ypos-debug[Trace position validation]"
+ "-Ypresentation-debug[Enable debugging output for the presentation compiler]"
+ "-Yreify-debug[Trace reification]"
+ "-Yrepl-debug[Trace all REPL activity]"
+ "-Ytyper-debug[Trace all type assignments]"
+)
+
+local -a scala_opts
+scala_opts=(
+ "-e+[execute <string> as if entered in the repl]:string" \
+ "-howtorun+[what to run (default\: guess)]:execution mode:(script object jar guess)" \
+ "-i+[preload <file> before starting the repl]:file to preload:_files" \
+ "-nc[no compilation daemon\: do not use the fsc offline compiler]" \
+ "-save[save the compiled script in a jar for future use]"
+)
+
+case $words[$CURRENT] in
+ -X*) _arguments $X_opts;;
+ -Y*) _arguments $Y_opts;;
+ *) case $service in
+ scala) _arguments $scala_opts $shared_opts "*::filename:_files";;
+ scalac) _arguments $shared_opts "*::filename:_files";;
+ esac
+esac
+
+return 0
diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
index c4e92a1fe..7468749f8 100644
--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
@@ -6,11 +6,17 @@
#
# zstyle :omz:plugins:ssh-agent agent-forwarding on
#
-# To load multiple identies use the identities style, For
+# To load multiple identities use the identities style, For
# example:
#
# zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github
#
+# To set the maximum lifetime of the identities, use the
+# lifetime style. The lifetime may be specified in seconds
+# or as described in sshd_config(5) (see TIME FORMATS)
+# If left unspecified, the default lifetime is forever.
+#
+# zstyle :omz:plugins:ssh-agent lifetime 4h
#
# CREDITS
#
@@ -27,15 +33,18 @@ local _plugin__forwarding
function _plugin__start_agent()
{
local -a identities
+ local lifetime
+ zstyle -s :omz:plugins:ssh-agent lifetime lifetime
# start ssh-agent and setup environment
- /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${_plugin__ssh_env}
+ /usr/bin/env ssh-agent ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' > ${_plugin__ssh_env}
chmod 600 ${_plugin__ssh_env}
. ${_plugin__ssh_env} > /dev/null
# load identies
zstyle -a :omz:plugins:ssh-agent identities identities
- echo starting...
+ echo starting ssh-agent...
+
/usr/bin/ssh-add $HOME/.ssh/${^identities}
}
diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh
index 1b2cbcdce..e74695de0 100755
--- a/plugins/sublime/sublime.plugin.zsh
+++ b/plugins/sublime/sublime.plugin.zsh
@@ -1,7 +1,12 @@
# Sublime Text 2 Aliases
-#unamestr = 'uname'
-local _sublime_darwin_subl=/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
+local _sublime_darwin_paths > /dev/null 2>&1
+_sublime_darwin_paths=(
+ "$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
+ "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
+ "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
+ "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
+)
if [[ $('uname') == 'Linux' ]]; then
if [ -f '/usr/bin/sublime_text' ]; then
@@ -9,13 +14,16 @@ if [[ $('uname') == 'Linux' ]]; then
else
st_run() { nohup /usr/bin/sublime-text $@ > /dev/null & }
fi
-alias st=st_run
+ alias st=st_run
+
elif [[ $('uname') == 'Darwin' ]]; then
- # Check if Sublime is installed in user's home application directory
- if [[ -a $HOME/${_sublime_darwin_subl} ]]; then
- alias st='$HOME/${_sublime_darwin_subl}'
- else
- alias st='${_sublime_darwin_subl}'
- fi
+
+ for _sublime_path in $_sublime_darwin_paths; do
+ if [[ -a $_sublime_path ]]; then
+ alias st="'$_sublime_path'"
+ break
+ fi
+ done
fi
+
alias stt='st .'
diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh
index f425c14f7..0d2bb68c3 100644
--- a/plugins/symfony2/symfony2.plugin.zsh
+++ b/plugins/symfony2/symfony2.plugin.zsh
@@ -14,6 +14,8 @@ compdef _symfony2 app/console
compdef _symfony2 sf
#Alias
-alias sf2='php app/console'
-alias sf2clear='php app/console cache:clear'
+alias sf='php app/console'
+alias sfcl='php app/console cache:clear'
+alias sfroute='php app/console router:debug'
+alias sfgb='php app/console generate:bundle'
diff --git a/plugins/tmux/tmux.extra.conf b/plugins/tmux/tmux.extra.conf
new file mode 100644
index 000000000..beffd380c
--- /dev/null
+++ b/plugins/tmux/tmux.extra.conf
@@ -0,0 +1,2 @@
+set -g default-terminal $ZSH_TMUX_TERM
+source $HOME/.tmux.conf
diff --git a/plugins/tmux/tmux.only.conf b/plugins/tmux/tmux.only.conf
new file mode 100644
index 000000000..0734df3e1
--- /dev/null
+++ b/plugins/tmux/tmux.only.conf
@@ -0,0 +1 @@
+set -g default-terminal $ZSH_TMUX_TERM
diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh
new file mode 100644
index 000000000..465f5b053
--- /dev/null
+++ b/plugins/tmux/tmux.plugin.zsh
@@ -0,0 +1,85 @@
+# Only run if tmux is actually installed
+if which tmux &> /dev/null
+ then
+ # Configuration variables
+ #
+ # Automatically start tmux
+ [[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART=false
+ # Only autostart once. If set to false, tmux will attempt to
+ # autostart every time your zsh configs are reloaded.
+ [[ -n "$ZSH_TMUX_AUTOSTART_ONCE" ]] || ZSH_TMUX_AUTOSTART_ONCE=true
+ # Automatically connect to a previous session if it exists
+ [[ -n "$ZSH_TMUX_AUTOCONNECT" ]] || ZSH_TMUX_AUTOCONNECT=true
+ # Automatically close the terminal when tmux exits
+ [[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART
+ # Set term to screen or screen-256color based on current terminal support
+ [[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true
+ # The TERM to use for non-256 color terminals.
+ # Tmux states this should be screen, but you may need to change it on
+ # systems without the proper terminfo
+ [[ -n "$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITHOUT_256COLOR="screen"
+ # The TERM to use for 256 color terminals.
+ # Tmux states this should be screen-256color, but you may need to change it on
+ # systems without the proper terminfo
+ [[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="screen-256color"
+
+
+ # Get the absolute path to the current directory
+ local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)"
+
+ # Determine if the terminal supports 256 colors
+ if [[ `tput colors` == "256" ]]
+ then
+ export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR
+ else
+ export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR
+ fi
+
+ # Set the correct local config file to use.
+ if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]]
+ then
+ #use this when they have a ~/.tmux.conf
+ export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.extra.conf"
+ else
+ #use this when they don't have a ~/.tmux.conf
+ export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.only.conf"
+ fi
+
+ # Wrapper function for tmux.
+ function _zsh_tmux_plugin_run()
+ {
+ # We have other arguments, just run them
+ if [[ -n "$@" ]]
+ then
+ \tmux $@
+ # Try to connect to an existing session.
+ elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]]
+ then
+ \tmux attach || \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session
+ [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
+ # Just run tmux, fixing the TERM variable if requested.
+ else
+ \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG`
+ [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
+ fi
+ }
+
+ # Use the completions for tmux for our function
+ compdef _tmux _zsh_tmux_plugin_run
+
+ # Alias tmux to our wrapper function.
+ alias tmux=_zsh_tmux_plugin_run
+
+ # Autostart if not already in tmux and enabled.
+ if [[ ! -n "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" ]]
+ then
+ # Actually don't autostart if we already did and multiple autostarts are disabled.
+ if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]]
+ then
+ export ZSH_TMUX_AUTOSTARTED=true
+ _zsh_tmux_plugin_run
+ fi
+ fi
+else
+ print "zsh tmux plugin: tmux not found. Please install tmux before using this plugin."
+fi
diff --git a/plugins/tmuxinator/_tmuxinator b/plugins/tmuxinator/_tmuxinator
new file mode 100644
index 000000000..f0ff304dd
--- /dev/null
+++ b/plugins/tmuxinator/_tmuxinator
@@ -0,0 +1,36 @@
+#compdef tmuxinator
+#autoload
+
+local curcontext="$curcontext" state line ret=1
+local -a _configs
+
+_arguments -C \
+ '1: :->cmds' \
+ '2:: :->args' && ret=0
+
+case $state in
+ cmds)
+ _values "tmuxinator command" \
+ "start[start a tmux session using project's tmuxinator config]" \
+ "open[create a new project file and open it in your editor]" \
+ "copy[copy source_project project file to a new project called new_project]" \
+ "delete[deletes the project called project_name]" \
+ "implode[deletes all existing projects!]" \
+ "list[list all existing projects]" \
+ "doctor[look for problems in your configuration]" \
+ "help[shows this help document]" \
+ "version[shows tmuxinator version number]"
+ ret=0
+ ;;
+ args)
+ case $line[1] in
+ start|open|copy|delete)
+ _configs=(`tmuxinator list | sed -n 's/^[ \t]\+//p'`)
+ _values 'configs' $_configs
+ ret=0
+ ;;
+ esac
+ ;;
+esac
+
+return ret \ No newline at end of file
diff --git a/plugins/torrent/torrent.plugin.zsh b/plugins/torrent/torrent.plugin.zsh
new file mode 100644
index 000000000..656e337de
--- /dev/null
+++ b/plugins/torrent/torrent.plugin.zsh
@@ -0,0 +1,17 @@
+#
+# Algorithm borrowed from http://wiki.rtorrent.org/MagnetUri and adapted to work with zsh.
+#
+
+function magnet_to_torrent() {
+ [[ "$1" =~ xt=urn:btih:([^\&/]+) ]] || return 1
+
+ hashh=${match[1]}
+
+ if [[ "$1" =~ dn=([^\&/]+) ]];then
+ filename=${match[1]}
+ else
+ filename=$hashh
+ fi
+
+ echo "d10:magnet-uri${#1}:${1}e" > "$filename.torrent"
+} \ No newline at end of file
diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant
index 9bed1e3c6..9af8cb036 100644
--- a/plugins/vagrant/_vagrant
+++ b/plugins/vagrant/_vagrant
@@ -8,18 +8,19 @@ _1st_arguments=(
'box:Box commands'
'destroy:Destroys the vagrant environment'
'halt:Halts the currently running vagrant environment'
- 'help:[TASK] Describe available tasks or one specific task'
'init:[box_name] [box_url] Initializes current folder for Vagrant usage'
'package:Packages a vagrant environment for distribution'
+ 'plugin:Plugin commands'
'provision:Run the provisioner'
'reload:Reload the vagrant environment'
'resume:Resumes a suspend vagrant environment'
'ssh:SSH into the currently running environment'
- 'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.'
+ 'ssh-config:outputs .ssh/config valid syntax for connecting to this environment via ssh.'
'status:Shows the status of the current Vagrant environment.'
'suspend:Suspends the currently running vagrant environment'
'up:Creates the vagrant environment'
- 'version:Prints the Vagrant version information'
+ '--help:[TASK] Describe available tasks or one specific task'
+ '--version:Prints the Vagrant version information'
)
local -a _box_arguments
diff --git a/plugins/vundle/vundle.plugin.zsh b/plugins/vundle/vundle.plugin.zsh
index 005a58476..936c8d7d2 100644
--- a/plugins/vundle/vundle.plugin.zsh
+++ b/plugins/vundle/vundle.plugin.zsh
@@ -16,8 +16,12 @@ function vundle () {
vim -c "execute \"BundleInstall\" | q | q"
}
-
function vundle-update () {
vundle-init
vim -c "execute \"BundleInstall!\" | q | q"
}
+
+function vundle-clean () {
+ vundle-init
+ vim -c "execute \"BundleClean!\" | q | q"
+}
diff --git a/plugins/zeus/_zeus b/plugins/zeus/_zeus
new file mode 100644
index 000000000..5a13bd9ec
--- /dev/null
+++ b/plugins/zeus/_zeus
@@ -0,0 +1,34 @@
+#compdef zeus
+#autoload
+
+# in order to make this work, you will need to have the gem zeus installed
+
+# zeus zsh completion, based on adb completion
+
+local -a _1st_arguments
+_1st_arguments=(
+'console:Lets you interact with your Rails application from the command line. (alias = c)'
+'cucumber:Runs cucumber.'
+'dbconsole:Figures out which database you are using and drops you into whichever command line interface.'
+'destroy:Figures out what generate did, and undoes it. (alias = d)'
+'generate:Uses templates to create a whole lot of things. (alias = g)'
+'rake:Execute rake tasks.'
+'runner:Runs Ruby code in the context of Rails non-interactively. (alias = r)'
+'server:Launches a small web server named WEBrick which comes bundled with Ruby. (alias = s)'
+'start:Preloads the zeus environment'
+'test:Runs RSpec tests. (alias = rspec, testrb)'
+'version:Shows the version number.'
+)
+
+local expl
+local -a pkgs installed_pkgs
+
+_arguments \
+ '*:: :->subcmds' && return 0
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "zeus subcommand" _1st_arguments
+ return
+fi
+
+_files
diff --git a/plugins/zeus/zeus.plugin.zsh b/plugins/zeus/zeus.plugin.zsh
index 1658b34d3..eddfb4f94 100644
--- a/plugins/zeus/zeus.plugin.zsh
+++ b/plugins/zeus/zeus.plugin.zsh
@@ -2,12 +2,6 @@
# Zeus preloads your Rails environment and forks that process whenever
# needed. This effectively speeds up Rails' boot process to under 1 sec.
-# Always use bundler.
-# Rails depends on bundler, so we can be pretty sure, that there are no
-# problems with this command. For all the other aliases I provided an
-# alternative, in case people have conflicts with other plugins (e.g. suse).
-alias zeus='bundle exec zeus'
-
# Init
alias zi='zeus init'
alias zinit='zeus init'