Commit 78bbf7a6 authored by Robby Russell's avatar Robby Russell
Browse files

Merge pull request #3809 from ncanceill/easymerge

Easy-to-Merge
parents 9eaf5110 a7e79824
...@@ -19,8 +19,8 @@ alias zsr='zeus server' ...@@ -19,8 +19,8 @@ alias zsr='zeus server'
alias zerver='zeus server' alias zerver='zeus server'
# Rake # Rake
alias zr='zeus rake' alias zr='noglob zeus rake'
alias zake='zeus rake' alias zake='noglob zeus rake'
# Generate # Generate
alias zg='zeus generate' alias zg='zeus generate'
......
...@@ -42,7 +42,7 @@ GREEN_BASE_START="${PR_RESET}${PR_GREY}>${PR_RESET}${PR_GREEN}>${PR_BRIGHT_GREEN ...@@ -42,7 +42,7 @@ GREEN_BASE_START="${PR_RESET}${PR_GREY}>${PR_RESET}${PR_GREEN}>${PR_BRIGHT_GREEN
GREEN_START_P1="${PR_RESET}${GREEN_BASE_START}${PR_RESET} " GREEN_START_P1="${PR_RESET}${GREEN_BASE_START}${PR_RESET} "
DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}" DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}"
VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}" VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}"
Vcs_CLEAN_COLOR="${PR_RESET}${PR_GREEN}" VCS_CLEAN_COLOR="${PR_RESET}${PR_GREEN}"
VCS_SUFIX_COLOR="${PR_RESET}${PR_RED}${PR_RESET}" VCS_SUFIX_COLOR="${PR_RESET}${PR_RED}${PR_RESET}"
# ########## COLOR ########### # ########## COLOR ###########
# ########## SVN ########### # ########## SVN ###########
......
...@@ -126,7 +126,7 @@ prompt_hg() { ...@@ -126,7 +126,7 @@ prompt_hg() {
if `hg st | grep -q "^\?"`; then if `hg st | grep -q "^\?"`; then
prompt_segment red black prompt_segment red black
st='±' st='±'
elif `hg st | grep -q "^(M|A)"`; then elif `hg st | grep -q "^[MA]"`; then
prompt_segment yellow black prompt_segment yellow black
st='±' st='±'
else else
......
...@@ -38,34 +38,32 @@ function _ruby_version() { ...@@ -38,34 +38,32 @@ function _ruby_version() {
# Determine the time since last commit. If branch is clean, # Determine the time since last commit. If branch is clean,
# use a neutral color, otherwise colors will vary according to time. # use a neutral color, otherwise colors will vary according to time.
function _git_time_since_commit() { function _git_time_since_commit() {
if git rev-parse --git-dir > /dev/null 2>&1; then # Only proceed if there is actually a commit.
# Only proceed if there is actually a commit. if git log -1 > /dev/null 2>&1; then
if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then # Get the last commit.
# Get the last commit. last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null)
last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null) now=$(date +%s)
now=$(date +%s) seconds_since_last_commit=$((now-last_commit))
seconds_since_last_commit=$((now-last_commit))
# Totals
# Totals minutes=$((seconds_since_last_commit / 60))
minutes=$((seconds_since_last_commit / 60)) hours=$((seconds_since_last_commit/3600))
hours=$((seconds_since_last_commit/3600))
# Sub-hours and sub-minutes
# Sub-hours and sub-minutes days=$((seconds_since_last_commit / 86400))
days=$((seconds_since_last_commit / 86400)) sub_hours=$((hours % 24))
sub_hours=$((hours % 24)) sub_minutes=$((minutes % 60))
sub_minutes=$((minutes % 60))
if [ $hours -gt 24 ]; then
if [ $hours -gt 24 ]; then commit_age="${days}d"
commit_age="${days}d" elif [ $minutes -gt 60 ]; then
elif [ $minutes -gt 60 ]; then commit_age="${sub_hours}h${sub_minutes}m"
commit_age="${sub_hours}h${sub_minutes}m" else
else commit_age="${minutes}m"
commit_age="${minutes}m"
fi
color=$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL
echo "$color$commit_age%{$reset_color%}"
fi fi
color=$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL
echo "$color$commit_age%{$reset_color%}"
fi fi
} }
...@@ -99,4 +97,3 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[grey]%}" ...@@ -99,4 +97,3 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[grey]%}"
export LSCOLORS="exfxcxdxbxegedabagacad" export LSCOLORS="exfxcxdxbxegedabagacad"
export LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:' export LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:'
export GREP_COLOR='1;33' export GREP_COLOR='1;33'
# reference colors # Michele Bologna's theme
GREEN="%{$fg_bold[green]%}" # http://michelebologna.net
RED="%{$fg_bold[red]%}" #
CYAN="%{$fg_bold[cyan]%}" # This a theme for oh-my-zsh. Features a colored prompt with:
YELLOW="%{$fg_bold[yellow]%}" # * username@host: [jobs] [git] workdir %
BLUE="%{$fg_bold[blue]%}" # * hostname color is based on hostname characters. When using as root, the
MAGENTA="%{$fg_bold[magenta]%}" # prompt shows only the hostname in red color.
WHITE="%{$fg_bold[white]%}" # * [jobs], if applicable, counts the number of suspended jobs tty
# * [git], if applicable, represents the status of your git repo (more on that
COLOR_ARRAY=($GREEN $RED $CYAN $YELLOW $BLUE $MAGENTA $WHITE) # later)
# * '%' prompt will be green if last command return value is 0, yellow otherwise.
# color reset #
RESET_COLOR="%{$reset_color%}" # git prompt is inspired by official git contrib prompt:
# https://github.com/git/git/tree/master/contrib/completion/git-prompt.sh
# which color should be applied? # and it adds:
USERNAME_NORMAL_COLOR=$WHITE # * the current branch
USERNAME_ROOT_COLOR=$RED # * '%' if there are untracked files
HOSTNAME_NORMAL_COLOR=$BLUE # * '$' if there are stashed changes
# uncomment next line if you want auto-generated hostname color # * '*' if there are modified files
#for i in $HOST; HOSTNAME_NORMAL_COLOR=$COLOR_ARRAY[$[((#i))%7+1]] # * '+' if there are added files
HOSTNAME_ROOT_COLOR=$RED # * '<' if local repo is behind remote repo
HOSTNAME_COLOR=%(!.$HOSTNAME_ROOT_COLOR.$HOSTNAME_NORMAL_COLOR) # * '>' if local repo is ahead remote repo
CURRENT_DIR_COLOR=$CYAN # * '=' if local repo is equal to remote repo (in sync)
# * '<>' if local repo is diverged
# zsh commands
USERNAME_COMMAND="%n" local green="%{$fg_bold[green]%}"
HOSTNAME_COMMAND="%m" local red="%{$fg_bold[red]%}"
CURRENT_DIR="%~" local cyan="%{$fg_bold[cyan]%}"
local yellow="%{$fg_bold[yellow]%}"
# output: colors + commands local blue="%{$fg_bold[blue]%}"
USERNAME_OUTPUT="%(!..$USERNAME_NORMAL_COLOR$USERNAME_COMMAND$RESET_COLOR@)" local magenta="%{$fg_bold[magenta]%}"
HOSTNAME_OUTPUT="$HOSTNAME_COLOR$HOSTNAME_COMMAND$RESET_COLOR" local white="%{$fg_bold[white]%}"
CURRENT_DIR_OUTPUT="$CURRENT_DIR_COLOR$CURRENT_DIR" local reset="%{$reset_color%}"
LAST_COMMAND_OUTPUT="%(?.%(!.$RED.$GREEN).$YELLOW)"
local -a color_array
# git theming color_array=($green $red $cyan $yellow $blue $magenta $white)
ZSH_THEME_GIT_PROMPT_PREFIX="("
local username_normal_color=$white
local username_root_color=$red
local hostname_root_color=$red
# calculating hostname color with hostname characters
for i in `hostname`; local hostname_normal_color=$color_array[$[((#i))%7+1]]
local -a hostname_color
hostname_color=%(!.$hostname_root_color.$hostname_normal_color)
local current_dir_color=$blue
local username_command="%n"
local hostname_command="%m"
local current_dir="%~"
local username_output="%(!..$username_normal_color$username_command$reset@)"
local hostname_output="$hostname_color$hostname_command$reset"
local current_dir_output="$current_dir_color$current_dir$reset"
local jobs_bg="${red}fg: %j$reset"
local last_command_output="%(?.%(!.$red.$green).$yellow)"
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY=")$RED*" ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=")" ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_UNTRACKED="%%"
ZSH_THEME_GIT_PROMPT_MODIFIED="*"
ZSH_THEME_GIT_PROMPT_ADDED="+"
ZSH_THEME_GIT_PROMPT_STASHED="$"
ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="="
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">"
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<"
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="<>"
# wrap all together PROMPT='$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)'
PROMPT='$USERNAME_OUTPUT$HOSTNAME_OUTPUT:$CURRENT_DIR_OUTPUT $LAST_COMMAND_OUTPUT%#$RESET_COLOR ' PROMPT+='$(__git_ps1)'
RPROMPT='%1(j.fg: [%j].) $GREEN$(git_prompt_info)$RESET_COLOR [%@]' PROMPT+=" $last_command_output%#$reset "
RPROMPT=''
# terminal coloring
export CLICOLOR=1
export LSCOLORS=dxFxCxDxBxegedabagacad
local git_branch='$(git_prompt_info)%{$reset_color%}$(git_remote_status)'
PROMPT="%{$fg[green]%}╭─%n@%m %{$reset_color%}%{$fg[yellow]%}in %~ %{$reset_color%}${git_branch}
%{$fg[green]%}╰\$ %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%}on "
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}%{$fg[red]%} ✘ %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔ %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED=true
ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX="%{$fg[yellow]%}("
ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX="%{$fg[yellow]%})%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=" +"
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR=%{$fg[green]%}
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE=" -"
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR=%{$fg[red]%}
...@@ -41,10 +41,9 @@ then ...@@ -41,10 +41,9 @@ then
then then
_upgrade_zsh _upgrade_zsh
else else
echo "[Oh My Zsh] Would you like to check for updates?" echo "[Oh My Zsh] Would you like to check for updates? [Y/n]: \c"
echo "Type Y to update oh-my-zsh: \c"
read line read line
if [ "$line" = Y ] || [ "$line" = y ]; then if [ "$line" = Y ] || [ "$line" = y ] || [ -z "$line" ]; then
_upgrade_zsh _upgrade_zsh
else else
_update_zsh_update _update_zsh_update
......
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