Permalink
Browse files

Merge branch 'master' of git://github.com/robbyrussell/oh-my-zsh

* 'master' of git://github.com/robbyrussell/oh-my-zsh: (83 commits)
  Fixed bug introduced when fixing issue 896
  fixed introduced to parse_git_dirty
  changed variable PRE_1_7_2_GIT to POST_1_7_2_GIT to make it more accurate
  fixed asterisk display for modified repos in git prior to 1.7.2
  Removed trailing spaces in Git files. Fixes #867
  update rails runner alias to ru
  added rails to bundled_commands
  adding engine yard command (ey) to bundler binstubs
  adding rbenv support to all the rvm themes
  Add middleman to bundled commands
  Grammar update
  Updated to latest version of taskwarrior completions (using Taskwarrior 2.0b4)
  bug : stop creating those ~ directories add powit command to symlink an app if it hasn't been already
  don't check for tmp dir
  add alias to view the standard out (puts) from any pow app
  take in csexton's changes
  fix for pow plugin to default to current dir
  added a rake plugin to disable zsh file globbing when calling rake tasks with square brackets
  fix bundler plugin for root level folders
  fixing #812: adding plugins w/o plugin.zsh file to fpath.
  ...
  • Loading branch information...
2 parents f0d3270 + 1120f97 commit 26bea8115ec11df8068c98921739081376a97f7e @docwhat committed Mar 26, 2012
Showing with 824 additions and 214 deletions.
  1. +9 −1 README.textile
  2. +3 −1 lib/completion.zsh
  3. +2 −2 lib/functions.zsh
  4. +33 −1 lib/git.zsh
  5. +5 −8 lib/history.zsh
  6. +21 −10 oh-my-zsh.sh
  7. +1 −0 plugins/archlinux/archlinux.plugin.zsh
  8. +8 −2 plugins/autojump/autojump.plugin.zsh
  9. +20 −0 plugins/battery/battery.plugin.zsh
  10. +3 −7 plugins/bundler/bundler.plugin.zsh
  11. +37 −5 plugins/debian/debian.plugin.zsh
  12. +1 −0 plugins/django/django.plugin.zsh
  13. +0 −5 plugins/extract/extract.plugin.zsh
  14. +5 −2 plugins/git/git.plugin.zsh
  15. +11 −1 plugins/github/github.plugin.zsh
  16. +14 −0 plugins/jake-node/jake-node.plugin.zsh
  17. +14 −7 plugins/knife/_knife
  18. +5 −5 plugins/mercurial/mercurial.plugin.zsh
  19. +5 −0 plugins/nyan/nyan.plugin.zsh
  20. +46 −18 plugins/pip/_pip
  21. +63 −7 plugins/pow/pow.plugin.zsh
  22. +1 −0 plugins/rails/rails.plugin.zsh
  23. +3 −0 plugins/rails3/rails3.plugin.zsh
  24. +6 −0 plugins/rake/rake.plugin.zsh
  25. +44 −0 plugins/rbenv/rbenv.plugin.zsh
  26. +1 −1 plugins/ruby/ruby.plugin.zsh
  27. +1 −1 plugins/rvm/rvm.plugin.zsh
  28. +64 −0 plugins/sprunge/sprunge.plugin.zsh
  29. +13 −0 plugins/symfony2/symfony2.plugin.zsh
  30. +65 −97 plugins/taskwarrior/_task
  31. +11 −0 plugins/terminalapp/terminalapp.plugin.zsh
  32. +29 −0 plugins/wakeonlan/README
  33. +4 −0 plugins/wakeonlan/_wake
  34. +14 −0 plugins/wakeonlan/wakeonlan.plugin.zsh
  35. +5 −0 templates/zshrc.zsh-template
  36. +8 −2 themes/alanpeabody.zsh-theme
  37. +8 −1 themes/bira.zsh-theme
  38. +7 −1 themes/crunch.zsh-theme
  39. +7 −1 themes/dallas.zsh-theme
  40. +4 −0 themes/eastwood.zsh-theme
  41. +8 −1 themes/fino.zsh-theme
  42. +6 −0 themes/gallois.zsh-theme
  43. +2 −2 themes/jonathan.zsh-theme
  44. +2 −2 themes/josh.zsh-theme
  45. +8 −1 themes/macovsky-ruby.zsh-theme
  46. +7 −1 themes/macovsky.zsh-theme
  47. +24 −0 themes/mh.zsh-theme
  48. +58 −0 themes/mortalscumbag.zsh-theme
  49. +1 −1 themes/murilasso.zsh-theme
  50. +4 −0 themes/nebirhos.zsh-theme
  51. +9 −0 themes/pygmalion.zsh-theme
  52. +6 −0 themes/sammy.zsh-theme
  53. +7 −1 themes/superjarin.zsh-theme
  54. +30 −0 themes/suvash.zsh-theme
  55. +1 −1 themes/wuffers.zsh-theme
  56. +15 −0 themes/zhann.zsh-theme
  57. +17 −7 tools/check_for_upgrade.sh
  58. +18 −11 tools/upgrade.sh
View
@@ -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
@@ -48,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/@.
View
@@ -32,12 +32,14 @@ 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)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
hosts=(
+ "$_global_ssh_hosts[@]"
"$_ssh_hosts[@]"
"$_etc_hosts[@]"
- `hostname`
+ "$HOST"
localhost
)
zstyle ':completion:*:hosts' hosts $hosts
View
@@ -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() {
View
@@ -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 2> /dev/null) ]]; then
+ local SUBMODULE_SYNTAX=''
+ 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
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
@@ -62,3 +68,29 @@ git_prompt_status() {
fi
echo $STATUS
}
+
+#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
+}
+
+#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
+
+
View
@@ -3,14 +3,11 @@ HISTFILE=$HOME/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
-setopt hist_ignore_dups # ignore duplication command history list
-setopt share_history # share command history data
-
-setopt hist_verify
-setopt inc_append_history
+setopt append_history
setopt extended_history
setopt hist_expire_dups_first
+setopt hist_ignore_dups # ignore duplication command history list
setopt hist_ignore_space
-
-setopt SHARE_HISTORY
-setopt APPEND_HISTORY
+setopt hist_verify
+setopt inc_append_history
+setopt share_history # share command history data
View
@@ -13,13 +13,25 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
# TIP: Add files you don't want in git to .gitignore
for config_file ($ZSH/lib/*.zsh) source $config_file
+# Set ZSH_CUSTOM to the path where your custom config files
+# and plugins exists, or else we will use the default custom/
+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
@@ -28,12 +40,6 @@ done
autoload -U compinit
compinit -i
-# Set ZSH_CUSTOM to the path where your custom config files
-# and plugins exists, or else we will use the default custom/
-if [ "$ZSH_CUSTOM" = "" ]
-then
- ZSH_CUSTOM="$ZSH/custom"
-fi
# Load all of the plugins that were defined in ~/.zshrc
for plugin ($plugins); do
@@ -59,7 +65,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
@@ -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
@@ -1,3 +1,9 @@
-if [ -f `brew --prefix`/etc/autojump ]; then
- . `brew --prefix`/etc/autojump
+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
@@ -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
@@ -1,7 +1,3 @@
-fpath=($ZSH/plugins/bundler $fpath)
-autoload -U compinit
-compinit -i
-
alias be="bundle exec"
alias bi="bundle install"
alias bl="bundle list"
@@ -10,7 +6,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=(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
@@ -20,7 +16,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
@@ -41,6 +37,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
@@ -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
@@ -220,3 +220,4 @@ _managepy() {
compdef _managepy manage.py
compdef _managepy django
+compdef _managepy django-manage
@@ -78,8 +78,3 @@ function extract() {
alias x=extract
-# add extract completion function to path
-fpath=($ZSH/plugins/extract $fpath)
-autoload -U compinit
-compinit -i
-
@@ -9,14 +9,15 @@ 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
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'
@@ -35,6 +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'
# Git and svn mix
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
@@ -57,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
@@ -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 #################################################################
Oops, something went wrong.

0 comments on commit 26bea81

Please sign in to comment.