1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-12 00:40:07 +00:00

Merge remote-tracking branch 'robbyrussell/master'

This commit is contained in:
Adam Lindberg 2011-06-07 15:31:26 +02:00
commit 86b8827d27
16 changed files with 139 additions and 97 deletions

View file

@ -52,11 +52,11 @@ git_prompt_status() {
if $(echo "$INDEX" | grep '^R ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS"
fi
if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
if $(echo "$INDEX" | grep '^D ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
fi
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
fi
echo $STATUS
}
}

View file

@ -1,3 +1,9 @@
# 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
# add a function path
@ -28,7 +34,6 @@ done
for config_file ($ZSH/custom/*.zsh) source $config_file
# Load the theme
# Check for updates on initial load...
if [ "$ZSH_THEME" = "random" ]
then
themes=($ZSH/themes/*zsh-theme)
@ -41,11 +46,3 @@ else
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
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

View file

@ -2,14 +2,14 @@ stat -f%m . > /dev/null 2>&1
if [ "$?" = 0 ]; then
stat_cmd=(stat -f%m)
else
stat_cmd=(stat -L --format=%y)
stat_cmd=(stat -L --format=%Y)
fi
_ant_does_target_list_need_generating () {
if [ ! -f .ant_targets ]; then return 0;
else
accurate=$($stat_cmd -f%m .ant_targets)
changed=$($stat_cmd -f%m build.xml)
accurate=$($stat_cmd .ant_targets)
changed=$($stat_cmd build.xml)
return $(expr $accurate '>=' $changed)
fi
}

View file

@ -1,13 +1 @@
# 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'
function brew-link-completion {
ln -s "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" "$ZSH/plugins/brew/_brew.official"
}

View file

@ -1,8 +1,5 @@
# 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.
# 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"
}

View file

@ -1,2 +0,0 @@
# TODO: Don't do this in such a weird way.
export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/share/npm/bin:&|'`

View file

@ -1,7 +1,3 @@
fpath=($ZSH/plugins/rvm $fpath)
autoload -U compinit
compinit -i
alias rubies='rvm list rubies'
alias gemsets='rvm gemset list'
@ -35,10 +31,6 @@ function rvm-update {
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.
function gems {
local current_ruby=`rvm-prompt i v p`

View file

@ -13,7 +13,7 @@ function in_svn() {
}
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/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//"
@ -21,13 +21,13 @@ function svn_get_repo_name {
}
function svn_get_rev_nr {
if [ is_svn ]; then
if [ in_svn ]; then
svn info 2> /dev/null | sed -n s/Revision:\ //p
fi
}
function svn_dirty_choose {
if [ is_svn ]; then
if [ in_svn ]; then
s=$(svn status 2>/dev/null)
if [ $s ]; then
echo $1
@ -39,4 +39,4 @@ function svn_dirty_choose {
function svn_dirty {
svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN
}
}

View file

@ -0,0 +1,22 @@
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}"

26
themes/humza.zsh-theme Normal file
View file

@ -0,0 +1,26 @@
# 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%}"

View file

@ -0,0 +1,8 @@
# 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%} '

17
themes/nebirhos.zsh-theme Normal file
View file

@ -0,0 +1,17 @@
# 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]%})"

26
themes/sunaku.zsh-theme Normal file
View file

@ -0,0 +1,26 @@
# 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%}'

View file

@ -1,29 +0,0 @@
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

View file

@ -1,36 +1,36 @@
if [ -d ~/.oh-my-zsh ]
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
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
echo "Looking for an existing zsh config..."
echo "\033[0;34mLooking for an existing zsh config...\033[0m"
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
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;
rm ~/.zshrc;
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
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 "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`
echo ' __ __ '
echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
echo ' /____/'
echo "\033[0;32m"' __ __ '"\033[0m"
echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m"
echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m"
echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m"
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
source ~/.zshrc

View file

@ -1,12 +1,12 @@
current_path=`pwd`
echo "Upgrading Oh My Zsh"
echo "\033[0;34mUpgrading Oh My Zsh\033[0m"
( cd $ZSH && git pull origin master )
echo ' __ __ '
echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
echo ' /____/'
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 "To keep up on the latest, be sure to follow Oh My Zsh on twitter: http://twitter.com/ohmyzsh"
cd $current_path
echo "\033[0;32m"' __ __ '"\033[0m"
echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m"
echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m"
echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m"
echo "\033[0;32m"' /____/ '"\033[0m"
echo "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m"
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