Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: wfarr/oh-my-zsh
base: 2fca852ae6
...
head fork: wfarr/oh-my-zsh
compare: 0f8aee678e
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 61 additions and 15 deletions.
  1. +3 −3 templates/zshrc.zsh-template
  2. +58 −12 themes/wfarr.zsh-theme
View
6 templates/zshrc.zsh-template
@@ -34,10 +34,10 @@ plugins=(brew rails3 git textmate ruby bundler github pow osx rvm vagrant)
source $ZSH/oh-my-zsh.sh
# Customize to your needs...
-export PATH=/usr/local/Cellar/rbenv/bin:/Users/wfarr/bin:/usr/local/bin:/usr/local/sbin:$PATH
-export EDITOR='mate -w'
+export PATH=/usr/local/bin:/usr/local/sbin:$PATH
+export EDITOR='vim'
alias reload!='. ~/.zshrc'
alias be='nocorrect bundle exec'
-eval "$(rbenv init -)"
+source /opt/github/env.sh
View
70 themes/wfarr.zsh-theme
@@ -2,6 +2,62 @@ autoload colors && colors
# cheers, @ehrenmurdick
# http://github.com/ehrenmurdick/config/blob/master/zsh/prompt.zsh
+###
+# This stuff politely borrowed from http://zanshin.net/2011/08/12/oh-my-zsh/
+###
+
+# Colors vary depending on time lapsed.
+ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
+ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
+ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
+ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
+
+function git_time_since_commit() {
+ if git rev-parse --git-dir > /dev/null 2>&1; then
+ # Only proceed if there is actually a commit.
+ if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then
+ # Get the last commit.
+ last_commit=`git log --pretty=format:'%at' -1 2> /dev/null`
+ now=`date +%s`
+ seconds_since_last_commit=$((now-last_commit))
+
+ # Totals
+ MINUTES=$((seconds_since_last_commit / 60))
+ HOURS=$((seconds_since_last_commit/3600))
+
+ # Sub-hours and sub-minutes
+ DAYS=$((seconds_since_last_commit / 86400))
+ SUB_HOURS=$((HOURS % 24))
+ SUB_MINUTES=$((MINUTES % 60))
+
+ if [[ -n $(git status -s 2> /dev/null) ]]; then
+ if [ "$MINUTES" -gt 30 ]; then
+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
+ elif [ "$MINUTES" -gt 10 ]; then
+ COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM"
+ else
+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT"
+ fi
+ else
+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
+ fi
+
+ if [ "$HOURS" -gt 24 ]; then
+ echo "$COLOR(${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m)"
+ elif [ "$MINUTES" -gt 60 ]; then
+ echo "$COLOR(${HOURS}h${SUB_MINUTES}m)"
+ else
+ echo "$COLOR(${MINUTES}m)"
+ fi
+ else
+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
+ echo "$COLOR(~)"
+ fi
+ fi
+}
+
+### END BORROWED WITH LOVE
+
git_branch() {
echo $(/usr/bin/git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'})
}
@@ -16,7 +72,7 @@ git_dirty() {
then
echo "on %{$fg_bold[green]%}$(git_prompt_info)%{$reset_color%}"
else
- echo "on %{$fg_bold[red]%}$(git_prompt_info)%{$reset_color%}"
+ echo "on %{$fg_bold[red]%}$(git_prompt_info) $(git_time_since_commit)%{$reset_color%}"
fi
fi
}
@@ -27,16 +83,6 @@ git_prompt_info () {
echo "${ref#refs/heads/}"
}
-project_name () {
- name=$(pwd | awk -F'Development/' '{print $2}' | awk -F/ '{print $1}')
- echo $name
-}
-
-project_name_color () {
-# name=$(project_name)
- echo "%{\e[0;35m%}${name}%{\e[0m%}"
-}
-
unpushed () {
/usr/bin/git cherry -v origin/$(git_branch) 2>/dev/null
}
@@ -82,7 +128,7 @@ directory_name(){
echo "%{$fg_bold[yellow]%}%1/%\/%{$reset_color%}"
}
-export PROMPT=$'\n$(rbenv_prompt) in $(directory_name) $(project_name_color)$(git_dirty)$(need_push)\n› '
+export PROMPT=$'\n$(rbenv_prompt) in $(directory_name) $(git_dirty)$(need_push)\n› '
set_prompt () {
export RPROMPT="%{$fg_bold[grey]%}$(todo)%{$reset_color%}"
}

No commit comments for this range

Something went wrong with that request. Please try again.