diff --git a/lib/git.zsh b/lib/git.zsh index 2ace3d0e0..ce4de5598 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -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 -} \ No newline at end of file +} diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index dbff1ced9..d72d90cf9 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -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 diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh index 23bc7756a..691d4d2db 100644 --- a/plugins/ant/ant.plugin.zsh +++ b/plugins/ant/ant.plugin.zsh @@ -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 } diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index f584a4684..c2e95884e 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -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" -} diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh index 18f35333c..519bc18da 100644 --- a/plugins/node/node.plugin.zsh +++ b/plugins/node/node.plugin.zsh @@ -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" } diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh deleted file mode 100644 index 0b0a30e11..000000000 --- a/plugins/npm/npm.plugin.zsh +++ /dev/null @@ -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:&|'` diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 8a3ec788a..24621fe0b 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -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` diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index 45d461306..86050227d 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -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 -} \ No newline at end of file +} diff --git a/themes/alanpeabody.zsh-theme b/themes/alanpeabody.zsh-theme new file mode 100644 index 000000000..1f66f1ec3 --- /dev/null +++ b/themes/alanpeabody.zsh-theme @@ -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}" + diff --git a/themes/humza.zsh-theme b/themes/humza.zsh-theme new file mode 100644 index 000000000..107886295 --- /dev/null +++ b/themes/humza.zsh-theme @@ -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%}" diff --git a/themes/miloshadzic.zsh-theme b/themes/miloshadzic.zsh-theme new file mode 100644 index 000000000..ad5394423 --- /dev/null +++ b/themes/miloshadzic.zsh-theme @@ -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%} ' diff --git a/themes/nebirhos.zsh-theme b/themes/nebirhos.zsh-theme new file mode 100644 index 000000000..c49df972e --- /dev/null +++ b/themes/nebirhos.zsh-theme @@ -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]%})" diff --git a/themes/sunaku.zsh-theme b/themes/sunaku.zsh-theme new file mode 100644 index 000000000..440fa90b4 --- /dev/null +++ b/themes/sunaku.zsh-theme @@ -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%}' diff --git a/themes/thomasjbradley.zsh-theme b/themes/thomasjbradley.zsh-theme deleted file mode 100644 index 857301d19..000000000 --- a/themes/thomasjbradley.zsh-theme +++ /dev/null @@ -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]%}%{$reset_color%}>\ -< at %{$fg[yellow]%}%{$reset_color%}>\ -%{$fg[green]%}%{$reset_color%}< -patches: >" 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 diff --git a/tools/install.sh b/tools/install.sh index 8ed1403af..aedb706da 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -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 diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 6bdd02e38..e30488822 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -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 \ No newline at end of file +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