Commit 86b8827d authored by Adam Lindberg's avatar Adam Lindberg
Browse files

Merge remote-tracking branch 'robbyrussell/master'

parents 70cb607b ed990f61
...@@ -52,7 +52,7 @@ git_prompt_status() { ...@@ -52,7 +52,7 @@ git_prompt_status() {
if $(echo "$INDEX" | grep '^R ' &> /dev/null); then if $(echo "$INDEX" | grep '^R ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS"
fi fi
if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then if $(echo "$INDEX" | grep '^D ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
fi fi
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
......
# Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" != "true" ]
then
/usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh
fi
# Initializes Oh My Zsh # Initializes Oh My Zsh
# add a function path # add a function path
...@@ -28,7 +34,6 @@ done ...@@ -28,7 +34,6 @@ done
for config_file ($ZSH/custom/*.zsh) source $config_file for config_file ($ZSH/custom/*.zsh) source $config_file
# Load the theme # Load the theme
# Check for updates on initial load...
if [ "$ZSH_THEME" = "random" ] if [ "$ZSH_THEME" = "random" ]
then then
themes=($ZSH/themes/*zsh-theme) themes=($ZSH/themes/*zsh-theme)
...@@ -41,11 +46,3 @@ else ...@@ -41,11 +46,3 @@ else
source "$ZSH/themes/$ZSH_THEME.zsh-theme" source "$ZSH/themes/$ZSH_THEME.zsh-theme"
fi fi
# Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" = "true" ]
then
return
else
/usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh
fi
...@@ -2,14 +2,14 @@ stat -f%m . > /dev/null 2>&1 ...@@ -2,14 +2,14 @@ stat -f%m . > /dev/null 2>&1
if [ "$?" = 0 ]; then if [ "$?" = 0 ]; then
stat_cmd=(stat -f%m) stat_cmd=(stat -f%m)
else else
stat_cmd=(stat -L --format=%y) stat_cmd=(stat -L --format=%Y)
fi fi
_ant_does_target_list_need_generating () { _ant_does_target_list_need_generating () {
if [ ! -f .ant_targets ]; then return 0; if [ ! -f .ant_targets ]; then return 0;
else else
accurate=$($stat_cmd -f%m .ant_targets) accurate=$($stat_cmd .ant_targets)
changed=$($stat_cmd -f%m build.xml) changed=$($stat_cmd build.xml)
return $(expr $accurate '>=' $changed) return $(expr $accurate '>=' $changed)
fi fi
} }
......
# Move /usr/local/bin (path where brews are linked) to the front of the path
# This will allow us to override system binaries like ruby with our brews
# TODO: Do this in a more compatible way.
# What if someone doesn't have /usr/bin in their path?
export PATH=`echo $PATH | sed -e 's|/usr/local/bin||' -e 's|::|:|g'` # Remove /usr/local/bin
export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/bin:&|'` # Add it in front of /usr/bin
export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/sbin:&|'` # Add /usr/local/sbin
alias brews='brew list -1' alias brews='brew list -1'
function brew-link-completion {
ln -s "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" "$ZSH/plugins/brew/_brew.official"
}
# This works if you installed node via homebrew.
export NODE_PATH="/usr/local/lib/node"
# Open the node api for your current version to the optional section. # Open the node api for your current version to the optional section.
# TODO: Make the section part easier to use. # TODO: Make the section part easier to use.
function node-api { function node-docs {
open "http://nodejs.org/docs/$(node --version)/api/all.html#$1" open "http://nodejs.org/docs/$(node --version)/api/all.html#$1"
} }
# TODO: Don't do this in such a weird way.
export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/share/npm/bin:&|'`
fpath=($ZSH/plugins/rvm $fpath)
autoload -U compinit
compinit -i
alias rubies='rvm list rubies' alias rubies='rvm list rubies'
alias gemsets='rvm gemset list' alias gemsets='rvm gemset list'
...@@ -35,10 +31,6 @@ function rvm-update { ...@@ -35,10 +31,6 @@ function rvm-update {
rvm reload # TODO: Reload rvm completion? rvm reload # TODO: Reload rvm completion?
} }
function rvm-link-completion {
ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official"
}
# TODO: Make this usable w/o rvm. # TODO: Make this usable w/o rvm.
function gems { function gems {
local current_ruby=`rvm-prompt i v p` local current_ruby=`rvm-prompt i v p`
......
...@@ -13,7 +13,7 @@ function in_svn() { ...@@ -13,7 +13,7 @@ function in_svn() {
} }
function svn_get_repo_name { function svn_get_repo_name {
if [ is_svn ]; then if [ in_svn ]; then
svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//" svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//"
...@@ -21,13 +21,13 @@ function svn_get_repo_name { ...@@ -21,13 +21,13 @@ function svn_get_repo_name {
} }
function svn_get_rev_nr { function svn_get_rev_nr {
if [ is_svn ]; then if [ in_svn ]; then
svn info 2> /dev/null | sed -n s/Revision:\ //p svn info 2> /dev/null | sed -n s/Revision:\ //p
fi fi
} }
function svn_dirty_choose { function svn_dirty_choose {
if [ is_svn ]; then if [ in_svn ]; then
s=$(svn status 2>/dev/null) s=$(svn status 2>/dev/null)
if [ $s ]; then if [ $s ]; then
echo $1 echo $1
......
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 return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})'
local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
PROMPT="${user} ${pwd}$ "
RPROMPT="${return_code} ${git_branch} ${rvm}"
# ZSH THEME Preview: https://skitch.com/huyy/rk979/humza.zshtheme
let TotalBytes=0
for Bytes in $(ls -l | grep "^-" | awk '{ print $5 }')
do
let TotalBytes=$TotalBytes+$Bytes
done
# should it say b, kb, Mb, or Gb
if [ $TotalBytes -lt 1024 ]; then
TotalSize=$(echo -e "scale=3 \n$TotalBytes \nquit" | bc)
suffix="b"
elif [ $TotalBytes -lt 1048576 ]; then
TotalSize=$(echo -e "scale=3 \n$TotalBytes/1024 \nquit" | bc)
suffix="kb"
elif [ $TotalBytes -lt 1073741824 ]; then
TotalSize=$(echo -e "scale=3 \n$TotalBytes/1048576 \nquit" | bc)
suffix="Mb"
else
TotalSize=$(echo -e "scale=3 \n$TotalBytes/1073741824 \nquit" | bc)
suffix="Gb"
fi
PROMPT='%{$reset_color%}%n %{$fg[green]%}{%{$reset_color%}%~%{$fg[green]%}}%{$reset_color%}$(git_prompt_info) greetings, earthling %{$fg[green]%}[%{$reset_color%}%{$TotalSize%}%{$suffix%}%{$fg[green]%}]%{$fg[red]%}$%{$reset_color%} ☞ '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}±("
ZSH_THEME_GIT_PROMPT_SUFFIX=");%{$reset_color%}"
# Yay! High voltage and arrows!
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
PROMPT='%{$fg[cyan]%}%1~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$reset_color%} '
# Based on robbyrussell's theme, with host and rvm indicators. Example:
# @host ➜ currentdir rvm:(rubyversion@gemset) git:(branchname)
# 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%} "
fi
# Get the host name (first 4 chars)
HOST_PROMPT_="%{$fg_bold[red]%}@$HOST[0,4] ➜ %{$fg_bold[cyan]%}%c "
GIT_PROMPT="%{$fg_bold[blue]%}\$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}"
PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$GIT_PROMPT"
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
# Git-centric variation of the "fishy" theme.
# See screenshot at http://ompldr.org/vOHcwZg
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}+"
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[magenta]%}!"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}-"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}>"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}#"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[yellow]%}?"
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX=" "
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
local user_color='green'
test $UID -eq 0 && user_color='red'
PROMPT='%(?..%{$fg_bold[red]%}exit %?
%{$reset_color%})'\
'%{$bold_color%}$(git_prompt_status)%{$reset_color%}'\
'$(git_prompt_info)'\
'%{$fg[$user_color]%}%~%{$reset_color%}'\
'%(!.#.>) '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
function prompt_char {
git branch >/dev/null 2>/dev/null && echo '±' && return
hg root >/dev/null 2>/dev/null && echo '☿' && return
echo '○'
}
function virtualenv_info {
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
}
function hg_prompt_info {
hg prompt --angle-brackets "\
< on %{$fg[magenta]%}<branch>%{$reset_color%}>\
< at %{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\
%{$fg[green]%}<status|modified|unknown><update>%{$reset_color%}<
patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null
}
PROMPT='
%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)
$(virtualenv_info)$(prompt_char) '
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
ZSH_THEME_GIT_PROMPT_CLEAN=""
. ~/bin/dotfiles/zsh/aliases
if [ -d ~/.oh-my-zsh ] if [ -d ~/.oh-my-zsh ]
then then
echo "You already have Oh My Zsh installed. You'll need to remove ~/.oh-my-zsh if you want to install" echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install"
exit exit
fi fi
echo "Cloning Oh My Zsh..." echo "\033[0;34mCloning Oh My Zsh...\033[0m"
/usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
echo "Looking for an existing zsh config..." echo "\033[0;34mLooking for an existing zsh config...\033[0m"
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ] if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
then then
echo "Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh"; echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32]Backing up to ~/.zshrc.pre-oh-my-zsh\033[0m";
cp ~/.zshrc ~/.zshrc.pre-oh-my-zsh; cp ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
rm ~/.zshrc; rm ~/.zshrc;
fi fi
echo "Using the Oh My Zsh template file and adding it to ~/.zshrc" echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
echo "Copying your current PATH and adding it to the end of ~/.zshrc for you." echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
echo "export PATH=$PATH" >> ~/.zshrc echo "export PATH=$PATH" >> ~/.zshrc
echo "Time to change your default shell to zsh!" echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
chsh -s `which zsh` chsh -s `which zsh`
echo ' __ __ ' echo "\033[0;32m"' __ __ '"\033[0m"
echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m"
echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m"
echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m"
echo ' /____/' echo "\033[0;32m"' /____/ '"\033[0m"
echo "\n\n ....is now installed." echo "\n\n \033[0;32m....is now installed.\033[0m"
/usr/bin/env zsh /usr/bin/env zsh
source ~/.zshrc source ~/.zshrc
current_path=`pwd` current_path=`pwd`
echo "Upgrading Oh My Zsh" echo "\033[0;34mUpgrading Oh My Zsh\033[0m"
( cd $ZSH && git pull origin master ) ( cd $ZSH && git pull origin master )
echo ' __ __ ' echo "\033[0;32m"' __ __ '"\033[0m"
echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m"
echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m"
echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m"
echo ' /____/' echo "\033[0;32m"' /____/ '"\033[0m"
echo "Hooray! Oh My Zsh has been updated and/or is at the current version. \nAny new updates will be reflected when you start your next terminal session." echo "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m"
echo "To keep up on the latest, be sure to follow Oh My Zsh on twitter: http://twitter.com/ohmyzsh" echo "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m"
cd $current_path cd $current_path
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment