From 2ca2ad3fc5b8635b22d33fd0f1c1511f44e9fff8 Mon Sep 17 00:00:00 2001 From: fceccon Date: Tue, 20 Sep 2011 12:04:06 +0200 Subject: [PATCH 01/65] First search in the custom folder for the theme --- oh-my-zsh.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c4522491..6ab2ba35 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -45,7 +45,12 @@ then else if [ ! "$ZSH_THEME" = "" ] then - source "$ZSH/themes/$ZSH_THEME.zsh-theme" + if [ -f "$ZSH/custom/$ZSH_THEME.zsh-theme" ] + then + source "$ZSH/custom/$ZSH_THEME.zsh-theme" + else + source "$ZSH/themes/$ZSH_THEME.zsh-theme" + fi fi fi From 7553d0171f7d1fe070a70af2c863fdadf6d7d5ac Mon Sep 17 00:00:00 2001 From: Gavin Huang Date: Tue, 18 Oct 2011 11:46:45 +0800 Subject: [PATCH 02/65] Replace "git-diff" with "git diff" in the git plugin --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 183c56c1..89b3259f 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -9,7 +9,7 @@ alias gup='git fetch && git rebase' compdef _git gup=git-fetch alias gp='git push' compdef _git gp=git-push -gdv() { git-diff -w "$@" | view - } +gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff alias gc='git commit -v' compdef _git gc=git-commit From 81d94e6c9e3ebe5f0cb094474b1b2f96d2cf567b Mon Sep 17 00:00:00 2001 From: Godwin Ko Date: Wed, 12 Oct 2011 12:16:23 +0800 Subject: [PATCH 03/65] add rails runner alias --- plugins/rails/rails.plugin.zsh | 1 + plugins/rails3/rails3.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index ac8119e8..4aa7a05d 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -2,6 +2,7 @@ alias ss='thin --stats "/thin/stats" start' alias sg='ruby script/generate' alias sd='ruby script/destroy' alias sp='ruby script/plugin' +alias sr='ruby script/runner' alias ssp='ruby script/spec' alias rdbm='rake db:migrate' alias sc='ruby script/console' diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh index f4ee637e..a817b483 100644 --- a/plugins/rails3/rails3.plugin.zsh +++ b/plugins/rails3/rails3.plugin.zsh @@ -14,6 +14,7 @@ alias rdb='_rails_command dbconsole' alias rdbm='rake db:migrate db:test:clone' alias rg='_rails_command generate' alias rp='_rails_command plugin' +alias rr='_rails_command runner' alias rs='_rails_command server' alias rsd='_rails_command server --debugger' alias devlog='tail -f log/development.log' From 6095fe4f7157ba444addaf436f9f44e3d491a784 Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Thu, 20 Oct 2011 14:12:13 +0800 Subject: [PATCH 04/65] add: battery plugin --- plugins/battery/battery.plugin.zsh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 plugins/battery/battery.plugin.zsh diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh new file mode 100644 index 00000000..bc75c5cf --- /dev/null +++ b/plugins/battery/battery.plugin.zsh @@ -0,0 +1,20 @@ +if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then + function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" } + function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') } + function battery_pct_prompt() { + b=$(battery_pct_remaining) + if [ $b -gt 50 ] ; then + color='green' + elif [ $b -gt 20 ] ; then + color='yellow' + else + color='red' + fi + echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}" + } +else + error_msg='no battery' + function battery_pct_remaining() { echo $error_msg } + function battery_time_remaining() { echo $error_msg } + function battery_pct_prompt() { echo '' } +fi From a5545bd31c76a4f34339dc4e7b87f74fa0174015 Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Thu, 20 Oct 2011 14:12:56 +0800 Subject: [PATCH 05/65] add: rbenv plugin --- plugins/rbenv/rbenv.plugin.zsh | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 plugins/rbenv/rbenv.plugin.zsh diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh new file mode 100644 index 00000000..136ea75e --- /dev/null +++ b/plugins/rbenv/rbenv.plugin.zsh @@ -0,0 +1,44 @@ +FOUND_RBENV=0 +for rbenvdir in "$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" ; do + if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then + FOUND_RBENV=1 + export RBENV_ROOT=$rbenvdir + export PATH=${rbenvdir}/bin:$PATH + eval "$(rbenv init -)" + + alias rubies="rbenv versions" + alias gemsets="rbenv gemset list" + + function current_ruby() { + echo "$(rbenv version-name)" + } + + function current_gemset() { + echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a') | head -n1" + } + + function gems { + local rbenv_path=$(rbenv prefix) + gem list $@ | sed \ + -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \ + -Ee "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \ + -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ + -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" + } + + function rbenv_prompt_info() { + if [[ -n $(current_gemset) ]] ; then + echo "$(current_ruby)@$(current_gemset)" + else + echo "$(current_ruby)" + fi + } + fi +done +unset rbenvdir + +if [ $FOUND_RBENV -eq 0 ] ; then + alias rubies='ruby -v' + function gemsets() { echo 'not supported' } + function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" } +fi From 31cddcd32427a5f5d3daa0da168d39aba5b510b4 Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Thu, 20 Oct 2011 15:27:49 +0800 Subject: [PATCH 06/65] fix: rbenv: I need to find a proper way to test changes... --- plugins/rbenv/rbenv.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh index 136ea75e..ae37404c 100644 --- a/plugins/rbenv/rbenv.plugin.zsh +++ b/plugins/rbenv/rbenv.plugin.zsh @@ -14,7 +14,7 @@ for rbenvdir in "$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" ; do } function current_gemset() { - echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a') | head -n1" + echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)" } function gems { From a2afccae194470e71dd256b594964ddfe0e5c221 Mon Sep 17 00:00:00 2001 From: ornicar Date: Tue, 25 Oct 2011 09:53:59 +0200 Subject: [PATCH 07/65] Add yaourt --sucre alias in archlinux plugin --- plugins/archlinux/archlinux.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index b5e51903..294dc535 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -9,6 +9,7 @@ if [[ -x `which yaourt` ]]; then alias yaconf='yaourt -C' # Fix all configuration files with vimdiff # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. + alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation alias yain='yaourt -S' # Install specific package(s) from the repositories alias yains='yaourt -U' # Install specific package not from the repositories but from a file alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies From 0f13387b074aa20b035251ea85e4f8a82eddbfa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Wed, 2 Nov 2011 03:55:26 +0100 Subject: [PATCH 08/65] Added completion plugin for jake --- plugins/jake-node/jake-node.plugin.zsh | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 plugins/jake-node/jake-node.plugin.zsh diff --git a/plugins/jake-node/jake-node.plugin.zsh b/plugins/jake-node/jake-node.plugin.zsh new file mode 100644 index 00000000..d629fa4b --- /dev/null +++ b/plugins/jake-node/jake-node.plugin.zsh @@ -0,0 +1,28 @@ +##-----Autocomplete for Jake tool---- +# Jake : https://github.com/mde/jake +# Warning : Jakefile should have the right cas : Jakefile +# Add a .jake_tasks file to your working directory +# Author : Alexandre Lacheze (@al3xstrat) +# Inspiration : http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh + +function _jake_does_task_list_need_generating () { + if [ ! -f .jake_tasks ]; then + return 0; + else + accurate=$(stat -f%m .jake_tasks) + changed=$(stat -f%m Jakefile) + return $(expr $accurate '>=' $changed) + fi +} + +function _jake () { + if [ -f Jakefile ]; then + if _jake_does_task_list_need_generating; then + echo "\nGenerating .jake_tasks..." > /dev/stderr + jake -T | cut -d " " -f 2 | sed -E "s/.\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" > .jake_tasks + fi + reply=( `cat .jake_tasks` ) + fi +} + +compctl -K _jake jake \ No newline at end of file From a78387cb5d46c98336a8fa0abd72d682f1c00c8b Mon Sep 17 00:00:00 2001 From: Alexandre Date: Wed, 2 Nov 2011 13:29:28 +0100 Subject: [PATCH 09/65] Minor modifications in comment-header --- plugins/jake-node/jake-node.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/jake-node/jake-node.plugin.zsh b/plugins/jake-node/jake-node.plugin.zsh index d629fa4b..d365aee9 100644 --- a/plugins/jake-node/jake-node.plugin.zsh +++ b/plugins/jake-node/jake-node.plugin.zsh @@ -1,7 +1,7 @@ -##-----Autocomplete for Jake tool---- +#---oh-my-zsh plugin : take Autocomplete for Jake tool--- # Jake : https://github.com/mde/jake -# Warning : Jakefile should have the right cas : Jakefile -# Add a .jake_tasks file to your working directory +# Warning : Jakefile should have the right case : Jakefile +# Warnign : Add a .jake_tasks file to your working directory # Author : Alexandre Lacheze (@al3xstrat) # Inspiration : http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh From 456993e03be3193056b9a18a809a18414cf9df00 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Wed, 2 Nov 2011 13:31:06 +0100 Subject: [PATCH 10/65] minor modifications in comment header (the revenge) --- plugins/jake-node/jake-node.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/jake-node/jake-node.plugin.zsh b/plugins/jake-node/jake-node.plugin.zsh index d365aee9..ff9f6b5c 100644 --- a/plugins/jake-node/jake-node.plugin.zsh +++ b/plugins/jake-node/jake-node.plugin.zsh @@ -1,4 +1,4 @@ -#---oh-my-zsh plugin : take Autocomplete for Jake tool--- +#---oh-my-zsh plugin : task Autocomplete for Jake tool--- # Jake : https://github.com/mde/jake # Warning : Jakefile should have the right case : Jakefile # Warnign : Add a .jake_tasks file to your working directory From 452f1213018551f6a388224bbfd1c84ef73b3770 Mon Sep 17 00:00:00 2001 From: Benjamin Boudreau Date: Mon, 7 Nov 2011 13:42:16 -0500 Subject: [PATCH 11/65] Add apt-history to debian plugin --- plugins/debian/debian.plugin.zsh | 42 ++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 09771881..16a5d54c 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -54,7 +54,7 @@ if [[ $use_sudo -eq 1 ]]; then # apt-get only alias ads="sudo $apt_pref dselect-upgrade" - + # Install all .deb files in the current directory. # Warning: you will need to put the glob in single quotes if you use: # glob_subst @@ -113,9 +113,6 @@ alias allpkgs='aptitude search -F "%p" --disable-columns ~i' alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' - - - # Functions ################################################################# # create a simple script that can be used to 'duplicate' a system apt-copy() { @@ -132,11 +129,46 @@ apt-copy() { chmod +x apt-copy.sh } +# Prints apt history +# Usage: +# apt-history install +# apt-history upgrade +# apt-history remove +# apt-history rollback +# apt-history list +# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html +apt-history () { + case "$1" in + install) + zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*) + ;; + upgrade|remove) + zgrep --no-filename $1 $(ls -rt /var/log/dpkg*) + ;; + rollback) + zgrep --no-filename upgrade $(ls -rt /var/log/dpkg*) | \ + grep "$2" -A10000000 | \ + grep "$3" -B10000000 | \ + awk '{print $4"="$5}' + ;; + list) + zcat $(ls -rt /var/log/dpkg*) + ;; + *) + echo "Parameters:" + echo " install - Lists all packages that have been installed." + echo " upgrade - Lists all packages that have been upgraded." + echo " remove - Lists all packages that have been removed." + echo " rollback - Lists rollback information." + echo " list - Lists all contains of dpkg logs." + ;; + esac +} # Kernel-package building shortcut kerndeb () { # temporarily unset MAKEFLAGS ( '-j3' will fail ) - MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' ) + MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' ) print '$MAKEFLAGS set to '"'$MAKEFLAGS'" appendage='-custom' # this shows up in $ (uname -r ) revision=$(date +"%Y%m%d") # this shows up in the .deb file name From 444145b495338ca3fbc86f0956003a1074f845df Mon Sep 17 00:00:00 2001 From: Mario Fernandez Date: Wed, 9 Nov 2011 23:01:45 +0100 Subject: [PATCH 12/65] FIX: commands like ruby and rake where not being completed --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 3c96b8da..89f62232 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -41,6 +41,6 @@ for cmd in $bundled_commands; do alias $cmd=bundled_$cmd if which _$cmd > /dev/null 2>&1; then - compdef _$cmd bundled_$cmd + compdef _$cmd bundled_$cmd=$cmd fi done From 7ec2dd984a7605b28fcaed411f33403802bc876a Mon Sep 17 00:00:00 2001 From: Russell Harmon Date: Wed, 16 Nov 2011 04:32:05 -0500 Subject: [PATCH 13/65] Use printf rather than echo -e in update.sh update.sh is an "sh" script, not a zsh or bash script. On platforms which have real sh, echo does not have the -e option. --- tools/upgrade.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 52a8cc4d..6ffe56f4 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -1,12 +1,12 @@ current_path=`pwd` -echo -e "\033[0;34mUpgrading Oh My Zsh\033[0m" +printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh" ( cd $ZSH && git pull origin master ) -echo -e "\033[0;32m"' __ __ '"\033[0m" -echo -e "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" -echo -e "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" -echo -e "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" -echo -e "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" -echo -e "\033[0;32m"' /____/ '"\033[0m" -echo -e "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m" -echo -e "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m" +printf '\033[0;32m%s\033[0m\n' ' __ __ ' +printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' +printf '\033[0;32m%s\033[0m\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' +printf '\033[0;32m%s\033[0m\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' +printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' +printf '\033[0;32m%s\033[0m\n' ' /____/ ' +printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.' +printf '\033[0;34m%s\033[1m%s\033[0m\n' 'To keep up on the latest, be sure to follow Oh My Zsh on twitter: ' 'http://twitter.com/ohmyzsh' cd "$current_path" From 10618f323f2915c2a7281e258a42d05faf1cc1af Mon Sep 17 00:00:00 2001 From: Matt Outten Date: Wed, 16 Nov 2011 11:14:26 -0500 Subject: [PATCH 14/65] Add the --format tag to knife list commands This commit adds the --format tag to all of the autocompletion functions. The default format changed from json to a "human readable" format as of version 0.10. This change should be backward compatible. Alternatively, these commands could be simplified by using the new default human readable format. --- plugins/knife/_knife | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/knife/_knife b/plugins/knife/_knife index 7f8c95ee..f336380a 100644 --- a/plugins/knife/_knife +++ b/plugins/knife/_knife @@ -138,27 +138,27 @@ _knife_options3() { # The chef_x_remote functions use knife to get a list of objects of type x on the server _chef_roles_remote() { - (knife role list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') + (knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') } _chef_clients_remote() { - (knife client list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') + (knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') } _chef_nodes_remote() { - (knife node list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') + (knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') } _chef_cookbooks_remote() { - (knife cookbook list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') + (knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') } _chef_sitecookbooks_remote() { - (knife cookbook site list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') + (knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') } _chef_data_bags_remote() { - (knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') + (knife data bag list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') } # The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server From 2c660c16ad818d4e1f001e392f7e82c7c02cbbc6 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 24 Nov 2011 13:51:55 +0100 Subject: [PATCH 15/65] Only alias git=hub if `hub --version` works. `hub` is crashing for me on a old CentOS setup with "undefined method `shelljoin'". On first use of the `git` function it is now checked if `hub --version` returns successfully. --- plugins/github/github.plugin.zsh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 9b0d5460..197e86a4 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -1,7 +1,17 @@ # Setup hub function for git, if it is available; http://github.com/defunkt/hub if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then # eval `hub alias -s zsh` - function git(){hub "$@"} + function git(){ + if ! (( $+_has_working_hub )); then + hub --version &> /dev/null + _has_working_hub=$(($? == 0)) + fi + if (( $_has_working_hub )) ; then + hub "$@" + else + command git "$@" + fi + } fi # Functions ################################################################# From 5260bfd4eba3787d5d32086b55ed728f3f3ab7f8 Mon Sep 17 00:00:00 2001 From: Gael Pasgrimaud Date: Sun, 27 Nov 2011 15:07:31 +0100 Subject: [PATCH 16/65] allow django-manage completion. http://pypi.python.org/pypi/DjangoDevKit --- plugins/django/django.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh index 1d72a2f2..0bbd031f 100644 --- a/plugins/django/django.plugin.zsh +++ b/plugins/django/django.plugin.zsh @@ -220,3 +220,4 @@ _managepy() { compdef _managepy manage.py compdef _managepy django +compdef _managepy django-manage From 31badac2ea2ecdc77cf4c339fcef9472940cb261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Fri, 2 Dec 2011 12:54:04 +0100 Subject: [PATCH 17/65] Jake-node plugin : update - remove the need to write a `jake_tasks` in the directory - use most recent usage of completion with zsh - tested for MacOSX and Ubuntu --- plugins/jake-node/jake-node.plugin.zsh | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/plugins/jake-node/jake-node.plugin.zsh b/plugins/jake-node/jake-node.plugin.zsh index ff9f6b5c..a9eef402 100644 --- a/plugins/jake-node/jake-node.plugin.zsh +++ b/plugins/jake-node/jake-node.plugin.zsh @@ -1,28 +1,14 @@ #---oh-my-zsh plugin : task Autocomplete for Jake tool--- # Jake : https://github.com/mde/jake -# Warning : Jakefile should have the right case : Jakefile -# Warnign : Add a .jake_tasks file to your working directory +# Warning : Jakefile should have the right case : Jakefile or jakefile +# Tested on : MacOSX 10.7 (Lion), Ubuntu 11.10 # Author : Alexandre Lacheze (@al3xstrat) # Inspiration : http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh -function _jake_does_task_list_need_generating () { - if [ ! -f .jake_tasks ]; then - return 0; - else - accurate=$(stat -f%m .jake_tasks) - changed=$(stat -f%m Jakefile) - return $(expr $accurate '>=' $changed) - fi -} - function _jake () { - if [ -f Jakefile ]; then - if _jake_does_task_list_need_generating; then - echo "\nGenerating .jake_tasks..." > /dev/stderr - jake -T | cut -d " " -f 2 | sed -E "s/.\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" > .jake_tasks - fi - reply=( `cat .jake_tasks` ) + if [ -f Jakefile ]||[ -f jakefile ]; then + compadd `jake -T | cut -d " " -f 2 | sed -E "s/.\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"` fi } -compctl -K _jake jake \ No newline at end of file +compdef _jake jake \ No newline at end of file From 1a49f6443c0230b8e182294546ed9ef2a5110bf2 Mon Sep 17 00:00:00 2001 From: Matt Parnell Date: Sat, 12 Nov 2011 21:09:27 -0800 Subject: [PATCH 18/65] add sprunge.us pastebin uploader - uses files, or pipes --- plugins/sprunge/sprunge.plugin.zsh | 64 ++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 plugins/sprunge/sprunge.plugin.zsh diff --git a/plugins/sprunge/sprunge.plugin.zsh b/plugins/sprunge/sprunge.plugin.zsh new file mode 100644 index 00000000..9f9432ac --- /dev/null +++ b/plugins/sprunge/sprunge.plugin.zsh @@ -0,0 +1,64 @@ +# Contributed and SLIGHTLY modded by Matt Parnell/ilikenwf +# Created by the blogger at the URL below...I don't know where to find his/her name +# Original found at http://www.shellperson.net/sprunge-pastebin-script/ + +usage() { +description | fmt -s >&2 +} + +description() { +cat << HERE + +DESCRIPTION + Upload data and fetch URL from the pastebin http://sprunge.us + +USAGE + $0 filename.txt + $0 text string + $0 < filename.txt + piped_data | $0 + +NOTES +-------------------------------------------------------------------------- +* INPUT METHODS * +$0 can accept piped data, STDIN redirection [&2 + if [ "$*" ]; then + echo Arguments present... >&2 + if [ -f "$*" ]; then + echo Uploading the contents of "$*"... >&2 + cat "$*" + else + echo Uploading the text: \""$*"\"... >&2 + echo "$*" + fi | curl -F 'sprunge=<-' http://sprunge.us + else + echo No arguments found, printing USAGE and exiting. >&2 + usage + fi + else + echo Using input from a pipe or STDIN redirection... >&2 + while read -r line ; do + echo $line + done | curl -F 'sprunge=<-' http://sprunge.us + fi +} From 03424fdadba13fea2297a94144e989926cabdcb3 Mon Sep 17 00:00:00 2001 From: Andrew Tch Date: Sun, 18 Dec 2011 00:23:31 +0200 Subject: [PATCH 19/65] Symfony 2 completion --- plugins/symfony2/symfony2.plugin.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 plugins/symfony2/symfony2.plugin.zsh diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh new file mode 100644 index 00000000..64426684 --- /dev/null +++ b/plugins/symfony2/symfony2.plugin.zsh @@ -0,0 +1,13 @@ +# Symfony2 basic command completion + +_symfony2_get_command_list () { + app/console --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }' +} + +_symfony2 () { + if [ -f app/console ]; then + compadd `_symfony2_get_command_list` + fi +} + +compdef _symfony2 app/console \ No newline at end of file From 1ced49b85a859b399728ce32ef77399874f5172b Mon Sep 17 00:00:00 2001 From: Cameron Johnston Date: Sun, 18 Dec 2011 22:15:00 -0700 Subject: [PATCH 20/65] adding support for chef environments in knife plugin --- plugins/knife/_knife | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/knife/_knife b/plugins/knife/_knife index 7f8c95ee..32ff9fc9 100644 --- a/plugins/knife/_knife +++ b/plugins/knife/_knife @@ -26,7 +26,7 @@ _knife() { case $state in knifecmd) - compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders + compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec environment index node recipe role search ssh status windows $cloudproviders ;; knifesubcmd) case $words[2] in @@ -42,6 +42,9 @@ _knife() { cookbook) compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload ;; + environment) + compadd -Q "$@" list create delete edit show "from file" + ;; node) compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete" ;; @@ -161,6 +164,10 @@ _chef_data_bags_remote() { (knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') } +_chef_environments_remote() { + (knife environment list | awk '{print $1}') +} + # The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server _chef_cookbooks_local() { (for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done) From a62d22726be1c3a02405bf327449e605be8fc5b2 Mon Sep 17 00:00:00 2001 From: Steven De Coeyer Date: Mon, 19 Dec 2011 15:26:37 +0100 Subject: [PATCH 21/65] show gemset next to ruby version --- themes/zhann.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/zhann.zsh-theme b/themes/zhann.zsh-theme index 6c056dfb..3dff29c9 100644 --- a/themes/zhann.zsh-theme +++ b/themes/zhann.zsh-theme @@ -1,5 +1,5 @@ PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' -RPROMPT='%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v) %{$reset_color%}' +RPROMPT='%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v g) %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" From a21dc477c26ce29c839ca3aa36af91efcad179ea Mon Sep 17 00:00:00 2001 From: Trevor Wennblom Date: Tue, 20 Dec 2011 16:16:02 -0600 Subject: [PATCH 22/65] add note about custom plugins --- templates/zshrc.zsh-template | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 1ab40aba..64b1ece6 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -23,6 +23,7 @@ ZSH_THEME="robbyrussell" # COMPLETION_WAITING_DOTS="true" # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) +# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) plugins=(git) From dd14e075b7dd39906e2075ac6dd8f5bcc66b6129 Mon Sep 17 00:00:00 2001 From: "julien@macbook" Date: Wed, 21 Dec 2011 15:03:55 +0100 Subject: [PATCH 23/65] Ignore submodules dirty in prompt info --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index f0434365..defa062c 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -6,7 +6,7 @@ function git_prompt_info() { # Checks if working tree is dirty parse_git_dirty() { - if [[ -n $(git status -s 2> /dev/null) ]]; then + if [[ -n $(git status -s --ignore-submodules=dirty 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" From d8521693f4e2c140391065e7b721d7452134259f Mon Sep 17 00:00:00 2001 From: Kyle Smith Date: Thu, 22 Dec 2011 14:02:01 -0500 Subject: [PATCH 24/65] Added support for entries in /etc/ssh/ssh_known_hosts. --- lib/completion.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/completion.zsh b/lib/completion.zsh index b3cc9182..0e5d480f 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -32,9 +32,11 @@ zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-dir cdpath=(.) # use /etc/hosts and known_hosts for hostname completion +[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$( Date: Fri, 23 Dec 2011 11:14:22 +0400 Subject: [PATCH 25/65] Added alias gcm='git checkout master --- plugins/git/git.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 183c56c1..c1b382b2 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -17,6 +17,7 @@ alias gca='git commit -v -a' compdef _git gca=git-commit alias gco='git checkout' compdef _git gco=git-checkout +alias gcm='git checkout master' alias gb='git branch' compdef _git gb=git-branch alias gba='git branch -a' From 0b583638ae7bc58928b77669919600e27f4738b0 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Sun, 11 Dec 2011 20:27:35 +0530 Subject: [PATCH 26/65] Fix upgrade and uninstall functions to pick up $ZSH value --- lib/functions.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index ef7cc638..d2dcadd0 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -3,11 +3,11 @@ function zsh_stats() { } function uninstall_oh_my_zsh() { - /bin/sh $ZSH/tools/uninstall.sh + /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh } function upgrade_oh_my_zsh() { - /bin/sh $ZSH/tools/upgrade.sh + /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh } function take() { From 59baf390e96751fc51299ecefe921ba8718ba3aa Mon Sep 17 00:00:00 2001 From: Tate Johnson Date: Mon, 26 Dec 2011 13:16:26 +1000 Subject: [PATCH 27/65] Black on white theme inspired by Sam Stephenson's terminal screenshot on https://github.com/sstephenson/rbenv --- themes/sammy.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/sammy.zsh-theme diff --git a/themes/sammy.zsh-theme b/themes/sammy.zsh-theme new file mode 100644 index 00000000..52e6e4bb --- /dev/null +++ b/themes/sammy.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg[white]%}%c$(git_prompt_info)$ % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="*)" +ZSH_THEME_GIT_PROMPT_CLEAN=")" From f999fd8e121c1fd4d097c25be59c6020e1aed830 Mon Sep 17 00:00:00 2001 From: Michael Holachek Date: Mon, 26 Dec 2011 12:20:02 -0500 Subject: [PATCH 28/65] Added example aliases in ZSH template. Added a new theme. Example aliases allow for an easier way to open ZSH config file/folder in Textmate. New theme is mh.zsh-theme. --- templates/zshrc.zsh-template | 4 ++++ themes/mh.zsh-theme | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 themes/mh.zsh-theme diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 1ab40aba..25cf4f23 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -7,6 +7,10 @@ ZSH=$HOME/.oh-my-zsh # time that oh-my-zsh is loaded. ZSH_THEME="robbyrussell" +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" + # Set to this to use case-sensitive completion # CASE_SENSITIVE="true" diff --git a/themes/mh.zsh-theme b/themes/mh.zsh-theme new file mode 100644 index 00000000..34a3765b --- /dev/null +++ b/themes/mh.zsh-theme @@ -0,0 +1,24 @@ +# mh theme +# preview: http://cl.ly/1y2x0W0E3t2C0F29043z + +# features: +# path is autoshortened to ~30 characters +# displays git status (if applicable in current folder) +# turns username green if superuser, otherwise it is white + +# if superuser make the username green +if [ $UID -eq 0 ]; then NCOLOR="green"; else NCOLOR="white"; fi + +# prompt +PROMPT='[%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[red]%}%30<...<%~%<<%{$reset_color%}]%(!.#.$) ' +RPROMPT='$(git_prompt_info)' + +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[gray]%}(%{$fg_no_bold[yellow]%}%B" +ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[gray]%})%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✱" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +export LSCOLORS="Gxfxcxdxbxegedabagacad" +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' From 480d1247b89ae089564eb0ca7d66aef989b9f5e5 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 26 Dec 2011 10:15:35 -0800 Subject: [PATCH 29/65] Updating installation documentation to show a curl example as well for those who don't have wget installed. --- README.textile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.textile b/README.textile index 2dbfbe5a..eca96808 100644 --- a/README.textile +++ b/README.textile @@ -8,6 +8,14 @@ h2. Setup h3. The automatic installer... (do you trust me?) +You can install this via the command line with either `curl` or `wget`. + +h4. via `curl` + +@curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh@ + +h4. via `wget` + @wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@ h3. The manual way From e43dd05a6a731462c6124598ce2e4d1a9d3a5160 Mon Sep 17 00:00:00 2001 From: Michael Andersen Date: Thu, 29 Dec 2011 01:30:43 +0100 Subject: [PATCH 30/65] Mortal Scumbag Theme --- themes/mortalscumbag.zsh-theme | 58 ++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 themes/mortalscumbag.zsh-theme diff --git a/themes/mortalscumbag.zsh-theme b/themes/mortalscumbag.zsh-theme new file mode 100644 index 00000000..7e25b149 --- /dev/null +++ b/themes/mortalscumbag.zsh-theme @@ -0,0 +1,58 @@ +function my_git_prompt() { + tester=$(git rev-parse --git-dir 2> /dev/null) || return + + INDEX=$(git status --porcelain 2> /dev/null) + STATUS="" + + # is branch ahead? + if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" + fi + + # is anything staged? + if $(echo "$INDEX" | grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED" + fi + + # is anything unstaged? + if $(echo "$INDEX" | grep -E -e '^[ MARC][MD] ' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" + fi + + # is anything untracked? + if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" + fi + + # is anything unmerged? + if $(echo "$INDEX" | grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then + STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" + fi + + if [[ -n $STATUS ]]; then + STATUS=" $STATUS" + fi + + echo "$ZSH_THEME_GIT_PROMPT_PREFIX$(my_current_branch)$STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX" +} + +function my_current_branch() { + echo $(current_branch || echo "(no branch)") +} + +function ssh_connection() { + if [[ -n $SSH_CONNECTION ]]; then + echo "%{$fg_bold[red]%}(ssh) " + fi +} + +PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n%# ' + +ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}" +ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}" +ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[magenta]%}↑" +ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●" +ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[red]%}●" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}●" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[red]%}✕" +ZSH_THEME_GIT_PROMPT_SUFFIX=" $fg_bold[white]›%{$reset_color%}" From 967e84ebaa180ad2ab1eebc9a512f94d93e84aea Mon Sep 17 00:00:00 2001 From: Andreas Steinel Date: Thu, 29 Dec 2011 02:22:40 +0100 Subject: [PATCH 31/65] multiple versions could occur and should also be highlighted --- plugins/rvm/rvm.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 24621fe0..604c0071 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -37,7 +37,7 @@ function gems { local current_gemset=`rvm-prompt g` gem list $@ | sed \ - -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \ + -Ee "s/\([0-9, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \ -Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \ -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" From 2176cf37fb1eed028c53a2095098d585489b1cce Mon Sep 17 00:00:00 2001 From: Simon Jefford Date: Thu, 29 Dec 2011 21:54:19 +0000 Subject: [PATCH 32/65] bundler plugin - don't "bundle exec rails" As per http://blog.wyeworks.com/2011/12/27/bundle-exec-rails-executes-bundler-setup-3-times --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 89f62232..7b73c8fe 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -10,7 +10,7 @@ alias bu="bundle update" # The following is based on https://github.com/gma/bundler-exec -bundled_commands=(cap capify cucumber foreman guard heroku nanoc rackup rails rainbows rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) +bundled_commands=(cap capify cucumber foreman guard heroku nanoc rackup rainbows rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) ## Functions From cb501645d70ad1e50b6b3d3553618e585074533f Mon Sep 17 00:00:00 2001 From: Gustavo Barron Date: Fri, 30 Dec 2011 12:11:41 -0600 Subject: [PATCH 33/65] Get the Hostname Main library should use ZSH native hostname function --- lib/completion.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 0e5d480f..b964595e 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -39,7 +39,7 @@ hosts=( "$_global_ssh_hosts[@]" "$_ssh_hosts[@]" "$_etc_hosts[@]" - `hostname` + "$HOST" localhost ) zstyle ':completion:*:hosts' hosts $hosts From a49fcea9f5d281cccce2ad421db253455a248109 Mon Sep 17 00:00:00 2001 From: Patrick Lindborg Date: Mon, 2 Jan 2012 21:48:19 +0100 Subject: [PATCH 34/65] Fixed the rfind command in the ruby plugin --- plugins/ruby/ruby.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh index 08ca9c60..38e4d7cd 100644 --- a/plugins/ruby/ruby.plugin.zsh +++ b/plugins/ruby/ruby.plugin.zsh @@ -3,4 +3,4 @@ alias sgem='sudo gem' # Find ruby file -alias rfind='find . -name *.rb | xargs grep -n' +alias rfind='find . -name "*.rb" | xargs grep -n' From 955825b1e9e484e4b6811a6ba8895924c1834493 Mon Sep 17 00:00:00 2001 From: Calogero Lo Leggio Date: Tue, 3 Jan 2012 18:03:53 +0100 Subject: [PATCH 35/65] autojump plugin enhanced --- plugins/autojump/autojump.plugin.zsh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh index 6f9b80bf..72c416a1 100644 --- a/plugins/autojump/autojump.plugin.zsh +++ b/plugins/autojump/autojump.plugin.zsh @@ -1,5 +1,9 @@ -if [ -f /opt/local/etc/profile.d/autojump.sh ]; then - . /opt/local/etc/profile.d/autojump.sh -elif [ -f `brew --prefix`/etc/autojump ]; then - . `brew --prefix`/etc/autojump +if [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package + . /usr/share/autojump/autojump.zsh +elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation + . /etc/profile.d/autojump.zsh +elif (`command -v brew >/dev/null`); then # mac os x with brew + if [ -f `brew --prefix`/etc/autojump ]; then + . `brew --prefix`/etc/autojump + fi fi From a28b8889ee80856b65dd792dedd7735a1b94443c Mon Sep 17 00:00:00 2001 From: Alexander Madyankin Date: Thu, 5 Jan 2012 11:16:17 +0600 Subject: [PATCH 36/65] Apple Terminal.app resume directory plugin --- plugins/terminalapp/terminalapp.plugin.zsh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 plugins/terminalapp/terminalapp.plugin.zsh diff --git a/plugins/terminalapp/terminalapp.plugin.zsh b/plugins/terminalapp/terminalapp.plugin.zsh new file mode 100644 index 00000000..4695ad05 --- /dev/null +++ b/plugins/terminalapp/terminalapp.plugin.zsh @@ -0,0 +1,11 @@ +# Set Apple Terminal.app resume directory +# based on this answer: http://superuser.com/a/315029 + +function chpwd { + local SEARCH=' ' + local REPLACE='%20' + local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}" + printf '\e]7;%s\a' "$PWD_URL" +} + +chpwd \ No newline at end of file From 9ac98f6ceb77df71c98558a122bc06f8adadf989 Mon Sep 17 00:00:00 2001 From: Chad Seeger Date: Thu, 5 Jan 2012 13:41:27 -0800 Subject: [PATCH 37/65] Git Plugin: adds 'grhh' alias for 'git reset HEAD --hard' --- plugins/git/git.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index c1b382b2..ec98d4ad 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -36,6 +36,8 @@ alias ga='git add' compdef _git ga=git-add alias gm='git merge' compdef _git gm=git-merge +alias grhh='git reset HEAD --hard' +compdef _git grhh=git-reset-head-hard # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' From 804c18ca53e832f20869a7681143464382e8a2df Mon Sep 17 00:00:00 2001 From: Mark Drago Date: Thu, 5 Jan 2012 17:39:13 -0500 Subject: [PATCH 38/65] remove the -v flag from a few mercurial aliases The -v flag for these commands really isn't very useful. It will output some information about the hooks it is running, but that is generally not useful and just noisy. The desire to add -v to these commands is exceptional and IMHO it's better to make the common case of not seeing those messages the supported behavior. --- plugins/mercurial/mercurial.plugin.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index 2988f0a4..caf0d9ef 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -1,14 +1,14 @@ # Mercurial -alias hgc='hg commit -v' -alias hgb='hg branch -v' +alias hgc='hg commit' +alias hgb='hg branch' alias hgba='hg branches' alias hgco='hg checkout' alias hgd='hg diff' alias hged='hg diffmerge' # pull and update -alias hgl='hg pull -u -v' -alias hgp='hg push -v' -alias hgs='hg status -v' +alias hgl='hg pull -u' +alias hgp='hg push' +alias hgs='hg status' # this is the 'git commit --amend' equivalent alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip' From 7a361870a97d9d34158542503f942fb0c67accfc Mon Sep 17 00:00:00 2001 From: lucapette Date: Fri, 6 Jan 2012 22:10:57 +0100 Subject: [PATCH 39/65] add annotate --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 7b73c8fe..55564a25 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -10,7 +10,7 @@ alias bu="bundle update" # The following is based on https://github.com/gma/bundler-exec -bundled_commands=(cap capify cucumber foreman guard heroku nanoc rackup rainbows rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) +bundled_commands=(annotate cap capify cucumber foreman guard heroku nanoc rackup rainbows rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) ## Functions From ae735335e186447b370d299376970a7ea949b474 Mon Sep 17 00:00:00 2001 From: Chad Seeger Date: Mon, 9 Jan 2012 15:19:19 -0800 Subject: [PATCH 40/65] Kill the compdef; Introduce 'grh' alias for 'git reset HEAD' --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index ec98d4ad..ae080662 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -36,8 +36,8 @@ alias ga='git add' compdef _git ga=git-add alias gm='git merge' compdef _git gm=git-merge +alias grh='git reset HEAD' alias grhh='git reset HEAD --hard' -compdef _git grhh=git-reset-head-hard # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' From 5809a4721dd1b575c1f4cbc3cc361520e97cd8b9 Mon Sep 17 00:00:00 2001 From: Calogero Lo Leggio Date: Tue, 10 Jan 2012 10:01:16 +0100 Subject: [PATCH 41/65] check if autojump is installed --- plugins/autojump/autojump.plugin.zsh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh index 72c416a1..6f0edb06 100644 --- a/plugins/autojump/autojump.plugin.zsh +++ b/plugins/autojump/autojump.plugin.zsh @@ -1,9 +1,9 @@ -if [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package - . /usr/share/autojump/autojump.zsh -elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation - . /etc/profile.d/autojump.zsh -elif (`command -v brew >/dev/null`); then # mac os x with brew - if [ -f `brew --prefix`/etc/autojump ]; then +if [ $commands[autojump] ]; then # check if autojump is installed + if [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package + . /usr/share/autojump/autojump.zsh + elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation + . /etc/profile.d/autojump.zsh + elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump ]; then # mac os x with brew . `brew --prefix`/etc/autojump fi fi From c04b4abe91b69c058bde8e5968abb759b9168b88 Mon Sep 17 00:00:00 2001 From: Daniel Bye Date: Fri, 13 Jan 2012 12:40:59 +0000 Subject: [PATCH 42/65] Removed calls to compinit in the extract and the bundler plugins. compinit should only be called once, after all modules, libs, etc are imported. --- plugins/bundler/bundler.plugin.zsh | 2 -- plugins/extract/extract.plugin.zsh | 2 -- 2 files changed, 4 deletions(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 55564a25..e120331f 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -1,6 +1,4 @@ fpath=($ZSH/plugins/bundler $fpath) -autoload -U compinit -compinit -i alias be="bundle exec" alias bi="bundle install" diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 8cc17f7d..383331cc 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -80,6 +80,4 @@ alias x=extract # add extract completion function to path fpath=($ZSH/plugins/extract $fpath) -autoload -U compinit -compinit -i From 0d99759cc371d7b8f70cde950f42cc3558559533 Mon Sep 17 00:00:00 2001 From: backspace Date: Sun, 15 Jan 2012 08:49:52 +0200 Subject: [PATCH 43/65] =?UTF-8?q?Don=E2=80=99t=20report=20that=20Oh=20My?= =?UTF-8?q?=20Zsh=20has=20been=20updated=20when=20it=20hasn=E2=80=99t.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/upgrade.sh | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 6ffe56f4..b2a1c06c 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -1,12 +1,19 @@ current_path=`pwd` printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh" -( cd $ZSH && git pull origin master ) -printf '\033[0;32m%s\033[0m\n' ' __ __ ' -printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' -printf '\033[0;32m%s\033[0m\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' -printf '\033[0;32m%s\033[0m\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' -printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' -printf '\033[0;32m%s\033[0m\n' ' /____/ ' -printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.' -printf '\033[0;34m%s\033[1m%s\033[0m\n' 'To keep up on the latest, be sure to follow Oh My Zsh on twitter: ' 'http://twitter.com/ohmyzsh' -cd "$current_path" +cd $ZSH + +if git pull origin master +then + printf '\033[0;32m%s\033[0m\n' ' __ __ ' + printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' + printf '\033[0;32m%s\033[0m\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' + printf '\033[0;32m%s\033[0m\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' + printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' + printf '\033[0;32m%s\033[0m\n' ' /____/ ' + printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.' + printf '\033[0;34m%s\033[1m%s\033[0m\n' 'To keep up on the latest, be sure to follow Oh My Zsh on twitter: ' 'http://twitter.com/ohmyzsh' +else + printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?' +fi + +cd "$current_path" \ No newline at end of file From b73f95ab260f49bf6baa484faa40591c51629c02 Mon Sep 17 00:00:00 2001 From: Daniel Bye Date: Mon, 16 Jan 2012 13:34:07 +0000 Subject: [PATCH 44/65] Removed the assignments to fpath as well, since that's all handled in the .oh-my-zsh/oh-my-zsh.sh boot script. --- plugins/bundler/bundler.plugin.zsh | 2 -- plugins/extract/extract.plugin.zsh | 3 --- 2 files changed, 5 deletions(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index e120331f..b473d203 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -1,5 +1,3 @@ -fpath=($ZSH/plugins/bundler $fpath) - alias be="bundle exec" alias bi="bundle install" alias bl="bundle list" diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 383331cc..5c125e98 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -78,6 +78,3 @@ function extract() { alias x=extract -# add extract completion function to path -fpath=($ZSH/plugins/extract $fpath) - From 73c2c8adc77568abdf2c7be1761c5cac6f06ad06 Mon Sep 17 00:00:00 2001 From: Nicolas Cavigneaux Date: Mon, 16 Jan 2012 15:19:36 +0100 Subject: [PATCH 45/65] Add Thor to bundled commands --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 55564a25..033f9ced 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -10,7 +10,7 @@ alias bu="bundle update" # The following is based on https://github.com/gma/bundler-exec -bundled_commands=(annotate cap capify cucumber foreman guard heroku nanoc rackup rainbows rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) +bundled_commands=(annotate cap capify cucumber foreman guard heroku nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails) ## Functions From 4b3429d765f1f14f7dbf2cc451e3047388978bf6 Mon Sep 17 00:00:00 2001 From: Arbo von Monkiewitsch Date: Mon, 16 Jan 2012 18:21:27 +0100 Subject: [PATCH 46/65] fixing #812: adding plugins w/o plugin.zsh file to fpath. --- oh-my-zsh.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index aeeaa3da..732a403b 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -19,13 +19,19 @@ if [[ -z "$ZSH_CUSTOM" ]]; then ZSH_CUSTOM="$ZSH/custom" fi + +is_plugin() { + local base_dir=$1 + local name=$2 + test -f $base_dir/plugins/$name/$name.plugin.zsh \ + || test -f $base_dir/plugins/$name/_$name +} # Add all defined plugins to fpath. This must be done # before running compinit. -plugin=${plugin:=()} for plugin ($plugins); do - if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then + if is_plugin $ZSH_CUSTOM $plugin; then fpath=($ZSH_CUSTOM/plugins/$plugin $fpath) - elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then + elif is_plugin $ZSH $plugin; then fpath=($ZSH/plugins/$plugin $fpath) fi done From 96265d26454868b8b654e4a5271939748e1dd148 Mon Sep 17 00:00:00 2001 From: Jeff Wallace Date: Tue, 17 Jan 2012 10:00:12 -0800 Subject: [PATCH 47/65] fix bundler plugin for root level folders this fix allows _within-bundled-project() to properly pickup a Gemfile within a root level folder (ie. /my_project) --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 033f9ced..b8f8ed3d 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -20,7 +20,7 @@ _bundler-installed() { _within-bundled-project() { local check_dir=$PWD - while [ "$(dirname $check_dir)" != "/" ]; do + while [ $check_dir != "/" ]; do [ -f "$check_dir/Gemfile" ] && return check_dir="$(dirname $check_dir)" done From 8f1a5d3f1581c80510728143e146143deecaa61e Mon Sep 17 00:00:00 2001 From: max sharples Date: Tue, 17 Jan 2012 13:11:01 +1100 Subject: [PATCH 48/65] added a rake plugin to disable zsh file globbing when calling rake tasks with square brackets --- plugins/rake/rake.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 plugins/rake/rake.plugin.zsh diff --git a/plugins/rake/rake.plugin.zsh b/plugins/rake/rake.plugin.zsh new file mode 100644 index 00000000..16b933c1 --- /dev/null +++ b/plugins/rake/rake.plugin.zsh @@ -0,0 +1,6 @@ +alias rake="noglob rake" # allows square brackts for rake task invocation +alias brake='noglob bundle exec rake' # execute the bundled rake gem +alias srake='noglob sudo rake' # noglob must come before sudo +alias sbrake='noglob sudo bundle exec rake' # altogether now ... + + From 741f6747e418229deec62ae2d19c776f6494e219 Mon Sep 17 00:00:00 2001 From: John Antoni Griffiths Date: Wed, 18 Jan 2012 12:52:27 -0500 Subject: [PATCH 49/65] fix for pow plugin to default to current dir --- plugins/pow/pow.plugin.zsh | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh index 6b2a6f2b..da94b657 100644 --- a/plugins/pow/pow.plugin.zsh +++ b/plugins/pow/pow.plugin.zsh @@ -1,10 +1,25 @@ -# Thanks to Christopher Sexton +# Restart a rack app running under pow +# http://pow.cx/ +# +# Adds a kapow command that will restart an app +# +# $ kapow myapp +# $ kapow # defaults to current directory +# +# Supports command completion. +# +# If you are not already using completion you might need to enable it with +# +# autoload -U compinit compinit +# +# Thanks also to Christopher Sexton # https://gist.github.com/965032 +# function kapow { - touch ~/.pow/$1/tmp/restart.txt - if [ $? -eq 0 ]; then - echo "$fg[yellow]Pow restarting $1...$reset_color" - fi + FOLDERNAME=$1 + if [ -z "$FOLDERNAME" ]; then; FOLDERNAME=${PWD##*/}; fi + touch ~/.pow/$FOLDERNAME/tmp/restart.txt; + if [ $? -eq 0 ]; then; echo "pow: restarting $FOLDERNAME" ; fi } compctl -W ~/.pow -/ kapow From c1a04eb61fcdd740bef52cd9da75fd72aeac3cf4 Mon Sep 17 00:00:00 2001 From: John Antoni Griffiths Date: Wed, 18 Jan 2012 12:58:13 -0500 Subject: [PATCH 50/65] take in csexton's changes https://gist.github.com/1019777/70dbb46db9bd5b346faf543a9dd4edac4782adda --- plugins/pow/pow.plugin.zsh | 45 +++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh index da94b657..08e5cf62 100644 --- a/plugins/pow/pow.plugin.zsh +++ b/plugins/pow/pow.plugin.zsh @@ -4,7 +4,6 @@ # Adds a kapow command that will restart an app # # $ kapow myapp -# $ kapow # defaults to current directory # # Supports command completion. # @@ -12,14 +11,40 @@ # # autoload -U compinit compinit # -# Thanks also to Christopher Sexton -# https://gist.github.com/965032 +# Changes: # -function kapow { - FOLDERNAME=$1 - if [ -z "$FOLDERNAME" ]; then; FOLDERNAME=${PWD##*/}; fi - touch ~/.pow/$FOLDERNAME/tmp/restart.txt; - if [ $? -eq 0 ]; then; echo "pow: restarting $FOLDERNAME" ; fi -} +# Defaults to the current application, and will walk up the tree to find +# a config.ru file and restart the corresponding app +# +# Will Detect if a app does not exist in pow and print a (slightly) helpful +# error message -compctl -W ~/.pow -/ kapow +rack_root_detect(){ + setopt chaselinks + local orgdir=$(pwd) + local basedir=$(pwd) + + while [[ $basedir != '/' ]]; do + test -e "$basedir/config.ru" && break + builtin cd ".." 2>/dev/null + basedir="$(pwd)" + done + + builtin cd $orgdir 2>/dev/null + [[ ${basedir} == "/" ]] && return 1 + echo `basename $basedir | sed -E "s/.(com|net|org)//"` +} +kapow(){ + local vhost=$1 + [ ! -n "$vhost" ] && vhost=$(rack_root_detect) + if [ ! -h ~/.pow/$vhost ] + then + echo "pow: This domain isn’t set up yet. Symlink your application to ${vhost} first." + return 1 + fi + + [ ! -d "~/.pow/${vhost}/tmp" ] && mkdir -p "~/.pow/$vhost/tmp" + touch ~/.pow/$vhost/tmp/restart.txt; + [ $? -eq 0 ] && echo "pow: restarting $vhost.dev" +} +compctl -W ~/.pow -/ kapow \ No newline at end of file From 36cd5ed1a59394827d6e9d38eca33b614790ded3 Mon Sep 17 00:00:00 2001 From: John Antoni Griffiths Date: Wed, 18 Jan 2012 14:18:09 -0500 Subject: [PATCH 51/65] add alias to view the standard out (puts) from any pow app --- plugins/pow/pow.plugin.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh index 08e5cf62..5ab55ff1 100644 --- a/plugins/pow/pow.plugin.zsh +++ b/plugins/pow/pow.plugin.zsh @@ -47,4 +47,7 @@ kapow(){ touch ~/.pow/$vhost/tmp/restart.txt; [ $? -eq 0 ] && echo "pow: restarting $vhost.dev" } -compctl -W ~/.pow -/ kapow \ No newline at end of file +compctl -W ~/.pow -/ kapow + +# View the standard out (puts) from any pow app +alias kaput="tail -f ~/Library/Logs/Pow/apps/*" \ No newline at end of file From 3841da15d02e6d36310b9cc1ebd62502d0bf2135 Mon Sep 17 00:00:00 2001 From: John Antoni Griffiths Date: Wed, 18 Jan 2012 18:07:31 -0500 Subject: [PATCH 52/65] don't check for tmp dir --- plugins/pow/pow.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh index 5ab55ff1..0fbcf8c7 100644 --- a/plugins/pow/pow.plugin.zsh +++ b/plugins/pow/pow.plugin.zsh @@ -43,7 +43,7 @@ kapow(){ return 1 fi - [ ! -d "~/.pow/${vhost}/tmp" ] && mkdir -p "~/.pow/$vhost/tmp" + # [ ! -d "~/.pow/${vhost}/tmp" ] && mkdir -p "~/.pow/$vhost/tmp" touch ~/.pow/$vhost/tmp/restart.txt; [ $? -eq 0 ] && echo "pow: restarting $vhost.dev" } From f9b4356e0ed9e95890ce79c982dd5481ba7803aa Mon Sep 17 00:00:00 2001 From: John Antoni Griffiths Date: Wed, 18 Jan 2012 18:36:11 -0500 Subject: [PATCH 53/65] bug : stop creating those ~ directories add powit command to symlink an app if it hasn't been already --- plugins/pow/pow.plugin.zsh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh index 0fbcf8c7..399a54cb 100644 --- a/plugins/pow/pow.plugin.zsh +++ b/plugins/pow/pow.plugin.zsh @@ -34,6 +34,7 @@ rack_root_detect(){ [[ ${basedir} == "/" ]] && return 1 echo `basename $basedir | sed -E "s/.(com|net|org)//"` } + kapow(){ local vhost=$1 [ ! -n "$vhost" ] && vhost=$(rack_root_detect) @@ -43,11 +44,23 @@ kapow(){ return 1 fi - # [ ! -d "~/.pow/${vhost}/tmp" ] && mkdir -p "~/.pow/$vhost/tmp" + [ ! -d ~/.pow/${vhost}/tmp ] && mkdir -p ~/.pow/$vhost/tmp touch ~/.pow/$vhost/tmp/restart.txt; [ $? -eq 0 ] && echo "pow: restarting $vhost.dev" } compctl -W ~/.pow -/ kapow +powit(){ + local basedir=$(pwd) + local vhost=$1 + [ ! -n "$vhost" ] && vhost=$(rack_root_detect) + if [ ! -h ~/.pow/$vhost ] + then + echo "pow: Symlinking your app with pow. ${vhost}" + [ ! -d ~/.pow/${vhost} ] && ln -s $basedir ~/.pow/$vhost + return 1 + fi +} + # View the standard out (puts) from any pow app -alias kaput="tail -f ~/Library/Logs/Pow/apps/*" \ No newline at end of file +alias kaput="tail -f ~/Library/Logs/Pow/apps/*" From 5f95d018e89e886615c82bc180e7e70457188c9b Mon Sep 17 00:00:00 2001 From: lepht Date: Wed, 18 Jan 2012 20:29:31 -0500 Subject: [PATCH 54/65] Updated to latest version of taskwarrior completions (using Taskwarrior 2.0b4) --- plugins/taskwarrior/_task | 160 +++++++++++++++----------------------- 1 file changed, 64 insertions(+), 96 deletions(-) diff --git a/plugins/taskwarrior/_task b/plugins/taskwarrior/_task index 5bffa911..0bda738b 100644 --- a/plugins/taskwarrior/_task +++ b/plugins/taskwarrior/_task @@ -1,37 +1,37 @@ #compdef task -# # zsh completion for taskwarrior # +# taskwarrior - a command line task list manager. +# # Copyright 2010 - 2011 Johannes Schlatow # Copyright 2009 P.C. Shyamshankar -# All rights reserved. # -# This script is part of the taskwarrior project. +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: # -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. # -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. # -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the -# -# Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, -# Boston, MA -# 02110-1301 -# USA +# http://www.opensource.org/licenses/mit-license.php # typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers _task_projects=($(task _projects)) _task_tags=($(task _tags)) _task_ids=($(task _ids)) _task_config=($(task _config)) +_task_columns=($(task _columns)) _task_modifiers=( 'before' \ 'after' \ @@ -46,39 +46,19 @@ _task_modifiers=( 'word' \ 'noword' ) +_task_conjunctions=( + 'and' \ + 'or' \ + 'xor' \ + '\)' + '\(' +) _task_cmds=($(task _commands)) _task_zshcmds=( ${(f)"$(task _zshcommands)"} ) - -_task_idCmds=( - 'append' \ - 'prepend' \ - 'annotate' \ - 'denotate' \ - 'edit' \ - 'duplicate' \ - 'info' \ - 'start' \ - 'stop' \ - 'done' -) - -_task_idCmdsDesc=( - 'append:Appends more description to an existing task.' \ - 'prepend:Prepends more description to an existing task.' \ - 'annotate:Adds an annotation to an existing task.' \ - 'denotate:Deletes an annotation of an existing task.' \ - 'edit:Launches an editor to let you modify a task directly.' \ - 'duplicate:Duplicates the specified task, and allows modifications.' \ - 'info:Shows all data, metadata for specified task.' \ - 'start:Marks specified task as started.' \ - 'stop:Removes the start time from a task.' \ - 'done:Marks the specified task as completed.' -) - _task() { _arguments -s -S \ - "*::task command:_task_commands" + "*::task default:_task_default" return 0 } @@ -148,6 +128,7 @@ _regex_words values 'task frequencies' \ 'weekly:Every week' \ 'biweekly:Every two weeks' \ 'fortnight:Every two weeks' \ ++ 'monthly:Every month' \ 'quarterly:Every three months' \ 'semiannual:Every six months' \ 'annual:Every year' \ @@ -196,22 +177,13 @@ _regex_arguments _task_attributes "${args[@]}" ## task commands -# default completion -(( $+functions[_task_default] )) || -_task_default() { +# filter completion +(( $+functions[_task_filter] )) || +_task_filter() { _task_attributes "$@" -} -# commands expecting an ID -(( $+functions[_task_id] )) || -_task_id() { - if (( CURRENT < 3 )); then - # update IDs - _task_zshids=( ${(f)"$(task _zshids)"} ) - _describe -t values 'task IDs' _task_zshids - else - _task_attributes "$@" - fi + # TODO complete conjunctions only if the previous word is a filter expression, i.e. attribute, ID, any non-command + _describe -t default 'task conjunctions' _task_conjunctions } # merge completion @@ -235,46 +207,42 @@ _task_pull() { _files } +# execute completion +(( $+functions[_task_execute] )) || +_task_execute() { + _files +} -# modify (task [0-9]* ...) completion -(( $+functions[_task_modify] )) || -_task_modify() { - _describe -t commands 'task command' _task_idCmdsDesc - _task_attributes "$@" +# id-only completion +(( $+functions[_task_id] )) || +_task_id() { + _describe -t values 'task IDs' _task_zshids } ## first level completion => task sub-command completion -(( $+functions[_task_commands] )) || -_task_commands() { +(( $+functions[_task_default] )) || +_task_default() { local cmd ret=1 - if (( CURRENT == 1 )); then - # update IDs - _task_zshids=( ${(f)"$(task _zshids)"} ) - _describe -t commands 'task command' _task_zshcmds - _describe -t values 'task IDs' _task_zshids - # TODO match more than one ID - elif [[ $words[1] =~ ^[0-9]*$ ]] then - _call_function ret _task_modify - return ret - else -# local curcontext="${curcontext}" -# cmd="${_task_cmds[(r)$words[1]:*]%%:*}" - cmd="${_task_cmds[(r)$words[1]]}" - idCmd="${(M)_task_idCmds[@]:#$words[1]}" - if (( $#cmd )); then -# curcontext="${curcontext%:*:*}:task-${cmd}" + integer i=1 + while (( i < $#words )) + do + cmd="${_task_cmds[(r)$words[$i]]}" + if (( $#cmd )); then + _call_function ret _task_${cmd} || + _call_function ret _task_filter || + _message "No command remaining." + return ret + fi + (( i++ )) + done - if (( $#idCmd )); then - _call_function ret _task_id - else - _call_function ret _task_${cmd} || - _call_function ret _task_default || - _message "No command remaining." - fi - else - _message "Unknown subcommand ${cmd}" - fi - return ret - fi + # update IDs + _task_zshids=( ${(f)"$(task _zshids)"} ) + + _describe -t commands 'task command' _task_zshcmds + _describe -t values 'task IDs' _task_zshids + _call_function ret _task_filter + + return ret } From 62a3ef643328a05c11a62cd42de12cf271ca1e69 Mon Sep 17 00:00:00 2001 From: "Steven G. Harms" Date: Sat, 21 Jan 2012 13:24:07 -0800 Subject: [PATCH 55/65] Grammar update --- README.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.textile b/README.textile index eca96808..bf677666 100644 --- a/README.textile +++ b/README.textile @@ -56,7 +56,7 @@ the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty fo h3. Customization If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory. -If you have many functions which go good together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin. +If you have many functions which go well together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin. If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@. From e0b235608032256f5b725676f7c6217480a52722 Mon Sep 17 00:00:00 2001 From: Tate Johnson Date: Sun, 22 Jan 2012 21:34:25 +1000 Subject: [PATCH 56/65] Add middleman to bundled commands --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 12123eea..74a3adaf 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 heroku nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails) +bundled_commands=(annotate cap capify cucumber foreman guard heroku middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails) ## Functions From 6496acf58bf8531809490b52e34811f74a27cc7c Mon Sep 17 00:00:00 2001 From: Brent Faulkner Date: Mon, 23 Jan 2012 20:42:54 -0500 Subject: [PATCH 57/65] adding rbenv support to all the rvm themes --- themes/alanpeabody.zsh-theme | 10 ++++++++-- themes/bira.zsh-theme | 9 ++++++++- themes/crunch.zsh-theme | 8 +++++++- themes/dallas.zsh-theme | 8 +++++++- themes/eastwood.zsh-theme | 4 ++++ themes/fino.zsh-theme | 9 ++++++++- themes/gallois.zsh-theme | 6 +++++- themes/jonathan.zsh-theme | 4 ++-- themes/josh.zsh-theme | 4 ++-- themes/macovsky-ruby.zsh-theme | 9 ++++++++- themes/macovsky.zsh-theme | 8 +++++++- themes/murilasso.zsh-theme | 2 +- themes/nebirhos.zsh-theme | 4 ++++ themes/superjarin.zsh-theme | 8 +++++++- themes/suvash.zsh-theme | 9 ++++++++- themes/wuffers.zsh-theme | 2 +- themes/zhann.zsh-theme | 10 +++++++++- 17 files changed, 96 insertions(+), 18 deletions(-) diff --git a/themes/alanpeabody.zsh-theme b/themes/alanpeabody.zsh-theme index 1f66f1ec..4a1b1b38 100644 --- a/themes/alanpeabody.zsh-theme +++ b/themes/alanpeabody.zsh-theme @@ -1,7 +1,14 @@ local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}' local pwd='%{$fg[blue]%}%~%{$reset_color%}' -local rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}' +local rvm='' +if which rvm-prompt &> /dev/null; then + rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}' +else + if which rbenv &> /dev/null; then + rvm='%{$fg[green]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' + fi +fi local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})' local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}' @@ -19,4 +26,3 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" PROMPT="${user} ${pwd}$ " RPROMPT="${return_code} ${git_branch} ${rvm}" - diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme index 5642eaeb..21572047 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -3,7 +3,14 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' -local rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' +local rvm_ruby='' +if which rvm-prompt &> /dev/null; then + rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' +else + if which rbenv &> /dev/null; then + rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' + fi +fi local git_branch='$(git_prompt_info)%{$reset_color%}' PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} diff --git a/themes/crunch.zsh-theme b/themes/crunch.zsh-theme index 2473cd23..b2759a1b 100644 --- a/themes/crunch.zsh-theme +++ b/themes/crunch.zsh-theme @@ -29,7 +29,13 @@ ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗" # Our elements: CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}" -CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" +if which rvm-prompt &> /dev/null; then + CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" +else + if which rbenv &> /dev/null; then + CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(rbenv version | sed -e 's/ (set.*$//' -e 's/^ruby-//')}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" + fi +fi CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) " CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ " diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme index eef32e99..e9b4f852 100644 --- a/themes/dallas.zsh-theme +++ b/themes/dallas.zsh-theme @@ -3,7 +3,13 @@ # Grab the current date (%D) and time (%T) wrapped in {}: {%D %T} DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%D %T%{$fg[white]%}}%{$reset_color%}" # Grab the current version of ruby in use (via RVM): [ruby-1.8.7] -DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" +if which rvm-prompt &> /dev/null; then + DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" +else + if which rbenv &> /dev/null; then + DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}" + fi +fi # Grab the current machine name: muscato DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" # Grab the current filepath, use shortcuts: ~/Desktop diff --git a/themes/eastwood.zsh-theme b/themes/eastwood.zsh-theme index 83664515..db252999 100644 --- a/themes/eastwood.zsh-theme +++ b/themes/eastwood.zsh-theme @@ -1,6 +1,10 @@ #RVM settings if [[ -s ~/.rvm/scripts/rvm ]] ; then RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1" +else + if which rbenv &> /dev/null; then + RPS1="%{$fg[yellow]%}rbenv:%{$reset_color%}%{$fg[red]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$reset_color%} $EPS1" + fi fi ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" diff --git a/themes/fino.zsh-theme b/themes/fino.zsh-theme index 17cf5970..26e54717 100644 --- a/themes/fino.zsh-theme +++ b/themes/fino.zsh-theme @@ -25,7 +25,14 @@ function box_name { } -local rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}' +local rvm_ruby='' +if which rvm-prompt &> /dev/null; then + rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}' +else + if which rbenv &> /dev/null; then + rvm_ruby='‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}' + fi +fi local current_dir='${PWD/#$HOME/~}' local git_info='$(git_prompt_info)' diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme index f9406dd9..3eac1486 100644 --- a/themes/gallois.zsh-theme +++ b/themes/gallois.zsh-theme @@ -15,7 +15,11 @@ git_custom_status() { if [[ -s ~/.rvm/scripts/rvm ]] ; then RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1' else - RPS1='$(git_custom_status) $EPS1' + if which rbenv &> /dev/null; then + RPS1='$(git_custom_status)%{$fg[red]%}[`rbenv version | sed -e "s/ (set.*$//"`]%{$reset_color%} $EPS1' + else + RPS1='$(git_custom_status) $EPS1' + fi fi PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b ' diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme index a170a13d..2f0c4b91 100644 --- a/themes/jonathan.zsh-theme +++ b/themes/jonathan.zsh-theme @@ -10,7 +10,7 @@ function theme_precmd { PR_PWDLEN="" local promptsize=${#${(%):---(%n@%m:%l)---()--}} - local rubyprompt=`rvm_prompt_info` + local rubyprompt=`rvm_prompt_info || rbenv_prompt_info` local rubypromptsize=${#${rubyprompt}} local pwdsize=${#${(%):-%~}} @@ -113,7 +113,7 @@ setprompt () { PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ $PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\ $PR_GREEN%$PR_PWDLEN<...<%~%<<\ -$PR_GREY)`rvm_prompt_info`$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\ +$PR_GREY)`rvm_prompt_info || rbenv_prompt_info`$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\ $PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\ $PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\ diff --git a/themes/josh.zsh-theme b/themes/josh.zsh-theme index 6bed1a70..142e7683 100644 --- a/themes/josh.zsh-theme +++ b/themes/josh.zsh-theme @@ -10,7 +10,7 @@ function josh_prompt { prompt=" " branch=$(current_branch) - ruby_version=$(rvm_prompt_info) + ruby_version=$(rvm_prompt_info || rbenv_prompt_info) path_size=${#PWD} branch_size=${#branch} ruby_size=${#ruby_version} @@ -31,7 +31,7 @@ function josh_prompt { prompt=" $prompt" done - prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $(git_prompt_info)" + prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(git_prompt_info)" echo $prompt } diff --git a/themes/macovsky-ruby.zsh-theme b/themes/macovsky-ruby.zsh-theme index 4eb41023..04537676 100644 --- a/themes/macovsky-ruby.zsh-theme +++ b/themes/macovsky-ruby.zsh-theme @@ -1,7 +1,14 @@ # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' +if which rvm-prompt &> /dev/null; then + PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' +else + if which rbenv &> /dev/null; then + PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' + fi +fi + RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" diff --git a/themes/macovsky.zsh-theme b/themes/macovsky.zsh-theme index 4eb41023..b6978b92 100644 --- a/themes/macovsky.zsh-theme +++ b/themes/macovsky.zsh-theme @@ -1,7 +1,13 @@ # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' +if which rvm-prompt &> /dev/null; then + PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' +else + if which rbenv &> /dev/null; then + PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' + fi +fi RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" diff --git a/themes/murilasso.zsh-theme b/themes/murilasso.zsh-theme index 310357b4..bc2b9b22 100644 --- a/themes/murilasso.zsh-theme +++ b/themes/murilasso.zsh-theme @@ -1,7 +1,7 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}' -local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info)%{$reset_color%}' +local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%}' local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}' PROMPT="${user_host}:${current_dir} ${rvm_ruby} diff --git a/themes/nebirhos.zsh-theme b/themes/nebirhos.zsh-theme index c49df972..c5864d9b 100644 --- a/themes/nebirhos.zsh-theme +++ b/themes/nebirhos.zsh-theme @@ -4,6 +4,10 @@ # Get the current ruby version in use with RVM: if [ -e ~/.rvm/bin/rvm-prompt ]; then RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(~/.rvm/bin/rvm-prompt s i v g)%{$fg_bold[blue]%})%{$reset_color%} " +else + if which rbenv &> /dev/null; then + RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg_bold[blue]%})%{$reset_color%} " + fi fi # Get the host name (first 4 chars) diff --git a/themes/superjarin.zsh-theme b/themes/superjarin.zsh-theme index 16eeb531..0be816de 100644 --- a/themes/superjarin.zsh-theme +++ b/themes/superjarin.zsh-theme @@ -1,5 +1,11 @@ # Grab the current version of ruby in use (via RVM): [ruby-1.8.7] -JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" +if which rvm-prompt &> /dev/null; then + JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" +else + if which rbenv &> /dev/null; then + JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}" + fi +fi # Grab the current filepath, use shortcuts: ~/Desktop # Append the current git branch, if in a git repository diff --git a/themes/suvash.zsh-theme b/themes/suvash.zsh-theme index f50657db..c87f6455 100644 --- a/themes/suvash.zsh-theme +++ b/themes/suvash.zsh-theme @@ -12,8 +12,15 @@ function collapse_pwd { echo $(pwd | sed -e "s,^$HOME,~,") } -PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%} +if which rvm-prompt &> /dev/null; then + PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $(virtualenv_info)$(prompt_char) ' +else + if which rbenv &> /dev/null; then + PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%} +$(virtualenv_info)$(prompt_char) ' + fi +fi ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" diff --git a/themes/wuffers.zsh-theme b/themes/wuffers.zsh-theme index 182d8a34..4019d0a5 100644 --- a/themes/wuffers.zsh-theme +++ b/themes/wuffers.zsh-theme @@ -2,4 +2,4 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}[" ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} " ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} x%{$fg_bold[blue]%}" -PROMPT='%{$(git_prompt_info)%}%{$fg_bold[green]%}{%{$(rvm current)%}}%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} ' +PROMPT='%{$(git_prompt_info)%}%{$fg_bold[green]%}{%{$(rvm current 2>/dev/null || rbenv version-name 2>/dev/null)%}}%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} ' diff --git a/themes/zhann.zsh-theme b/themes/zhann.zsh-theme index 3dff29c9..574e0cec 100644 --- a/themes/zhann.zsh-theme +++ b/themes/zhann.zsh-theme @@ -1,5 +1,13 @@ PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' -RPROMPT='%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v g) %{$reset_color%}' + +if which rvm-prompt &> /dev/null; then + RPROMPT='%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v g) %{$reset_color%}' +else + if which rbenv &> /dev/null; then + RPROMPT='%{$reset_color%} %{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//") %{$reset_color%}' + fi +fi + ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" From a26f9b9948405a10d3c04280a0ad2e49e69ba6f8 Mon Sep 17 00:00:00 2001 From: Alexander Greim Date: Wed, 25 Jan 2012 06:56:09 +0100 Subject: [PATCH 58/65] adding engine yard command (ey) to bundler binstubs --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 96c64966..5e9b8233 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 heroku middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails) +bundled_commands=(annotate cap capify cucumber ey foreman guard heroku middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails) ## Functions From 0da18650c6d8f63c230c36e92786855361f42ef3 Mon Sep 17 00:00:00 2001 From: Wim Griffioen Date: Thu, 26 Jan 2012 19:31:45 +0100 Subject: [PATCH 59/65] added rails to bundled_commands --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 5e9b8233..e1f57123 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 ey foreman guard heroku middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails) +bundled_commands=(annotate cap capify cucumber ey foreman guard heroku middleman nanoc rackup rainbows rails rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails) ## Functions From 35d89ab85991e9a6dc055d0fd790b50c1aaa0cce Mon Sep 17 00:00:00 2001 From: szetobo Date: Fri, 27 Jan 2012 08:50:28 +0800 Subject: [PATCH 60/65] update rails runner alias to ru - avoid rr as it is mostly used for restart rails server --- plugins/rails3/rails3.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh index a817b483..52fdf43e 100644 --- a/plugins/rails3/rails3.plugin.zsh +++ b/plugins/rails3/rails3.plugin.zsh @@ -14,7 +14,7 @@ alias rdb='_rails_command dbconsole' alias rdbm='rake db:migrate db:test:clone' alias rg='_rails_command generate' alias rp='_rails_command plugin' -alias rr='_rails_command runner' +alias ru='_rails_command runner' alias rs='_rails_command server' alias rsd='_rails_command server --debugger' alias devlog='tail -f log/development.log' From 8769e5f8c959f3d3fc9e5b62ab48fc0f73aedb1f Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Thu, 26 Jan 2012 23:19:50 -0800 Subject: [PATCH 61/65] Removed trailing spaces in Git files. Fixes #867 --- lib/git.zsh | 2 +- plugins/git/git.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index defa062c..4d1634e8 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -61,4 +61,4 @@ git_prompt_status() { STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" fi echo $STATUS -} +} \ No newline at end of file diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 94af3120..e1d68250 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -60,4 +60,4 @@ compdef ggpull=git alias ggpush='git push origin $(current_branch)' compdef ggpush=git alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' -compdef ggpnp=git +compdef ggpnp=git \ No newline at end of file From dc4d7a92c1a56509ed116a3ea44345f556c4f91b Mon Sep 17 00:00:00 2001 From: Aleksey Orekhov Date: Wed, 8 Feb 2012 15:19:12 -0500 Subject: [PATCH 62/65] fixed asterisk display for modified repos in git prior to 1.7.2 --- lib/git.zsh | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index 4d1634e8..c46aa608 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -4,15 +4,21 @@ function git_prompt_info() { echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" } + # Checks if working tree is dirty parse_git_dirty() { - if [[ -n $(git status -s --ignore-submodules=dirty 2> /dev/null) ]]; then + local SUBMODULE_SYNTAX='' + if [[ PRE_1_7_2_GIT -gt 0 ]]; then + SUBMODULE_SYNTAX="--ignore-submodules=dirty" + fi + if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" fi } + # Checks if there are commits ahead from remote function git_prompt_ahead() { if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then @@ -61,4 +67,30 @@ git_prompt_status() { STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" fi echo $STATUS -} \ No newline at end of file +} + +#this is unlikely to change so make it all statically assigned +PRE_1_7_2_GIT=$(git_compare_version "1.7.2") +#clean up the namespace slightly by removing the checker function +unset -f git_compare_version() + +#compare the provided version of git to the version installed and on path +#prints 1 if input version <= installed version +#prints -1 otherwise +function git_compare_version() { + local INPUT_GIT_VERSION=$1; + local INSTALLED_GIT_VERSION + INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION}); + INSTALLED_GIT_VERSION=($(git --version)); + INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}); + + for i in {1..3}; do + if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then + echo -1 + return 0 + fi + done + echo 1 +} + + From 7ea758834baa2694c2e9301fed1a71faa9f12166 Mon Sep 17 00:00:00 2001 From: Aleksey Orekhov Date: Wed, 8 Feb 2012 15:25:12 -0500 Subject: [PATCH 63/65] changed variable PRE_1_7_2_GIT to POST_1_7_2_GIT to make it more accurate --- lib/git.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index c46aa608..efaa943f 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -8,7 +8,7 @@ function git_prompt_info() { # Checks if working tree is dirty parse_git_dirty() { local SUBMODULE_SYNTAX='' - if [[ PRE_1_7_2_GIT -gt 0 ]]; then + if [[ POST_1_7_2_GIT -gt 0 ]]; then SUBMODULE_SYNTAX="--ignore-submodules=dirty" fi if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then @@ -70,7 +70,7 @@ git_prompt_status() { } #this is unlikely to change so make it all statically assigned -PRE_1_7_2_GIT=$(git_compare_version "1.7.2") +POST_1_7_2_GIT=$(git_compare_version "1.7.2") #clean up the namespace slightly by removing the checker function unset -f git_compare_version() From a9f6aed307f128a58176b151bc36854c9d3899f7 Mon Sep 17 00:00:00 2001 From: Aleksey Orekhov Date: Wed, 8 Feb 2012 15:30:58 -0500 Subject: [PATCH 64/65] fixed introduced to parse_git_dirty --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index efaa943f..d90f0f31 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -8,7 +8,7 @@ function git_prompt_info() { # Checks if working tree is dirty parse_git_dirty() { local SUBMODULE_SYNTAX='' - if [[ POST_1_7_2_GIT -gt 0 ]]; then + if [[ $POST_1_7_2_GIT -gt 0 ]]; then SUBMODULE_SYNTAX="--ignore-submodules=dirty" fi if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then From 5a5c93b33493b47d34dd470eb851aaf24fa87536 Mon Sep 17 00:00:00 2001 From: cruser42 Date: Tue, 21 Feb 2012 10:47:05 -0500 Subject: [PATCH 65/65] Fixed bug introduced when fixing issue 896 --- lib/git.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index d90f0f31..fb4ad8ca 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -69,11 +69,6 @@ git_prompt_status() { echo $STATUS } -#this is unlikely to change so make it all statically assigned -POST_1_7_2_GIT=$(git_compare_version "1.7.2") -#clean up the namespace slightly by removing the checker function -unset -f git_compare_version() - #compare the provided version of git to the version installed and on path #prints 1 if input version <= installed version #prints -1 otherwise @@ -93,4 +88,9 @@ function git_compare_version() { echo 1 } +#this is unlikely to change so make it all statically assigned +POST_1_7_2_GIT=$(git_compare_version "1.7.2") +#clean up the namespace slightly by removing the checker function +unset -f git_compare_version +