This commit is contained in:
GitHub Merge Button 2011-06-01 13:49:09 -07:00
commit e5d9e45167
3 changed files with 20 additions and 9 deletions

View file

@ -16,8 +16,9 @@ alias history='fc -l 1'
# List direcory contents # List direcory contents
alias lsa='ls -lah' alias lsa='ls -lah'
alias l='ls -la' alias l='ls -lA1'
alias ll='ls -l' alias ll='ls -l'
alias la='ls -lA'
alias sl=ls # often screw this up alias sl=ls # often screw this up
alias afind='ack-grep -il' alias afind='ack-grep -il'

View file

@ -37,8 +37,3 @@ cd () {
alias md='mkdir -p' alias md='mkdir -p'
alias rd=rmdir alias rd=rmdir
alias d='dirs -v' alias d='dirs -v'
# mkdir & cd to it
function mcd() {
mkdir -p "$1" && cd "$1";
}

View file

@ -5,7 +5,7 @@ function git_prompt_info() {
} }
# Checks if working tree is dirty # Checks if working tree is dirty
parse_git_dirty() { function parse_git_dirty() {
if [[ -n $(git status -s 2> /dev/null) ]]; then if [[ -n $(git status -s 2> /dev/null) ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY" echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else else
@ -15,11 +15,17 @@ parse_git_dirty() {
# Checks if there are commits ahead from remote # Checks if there are commits ahead from remote
function git_prompt_ahead() { function git_prompt_ahead() {
if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then if $(echo "$(git log $(git_current_remote)/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
echo "$ZSH_THEME_GIT_PROMPT_AHEAD" echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
fi fi
} }
function git_prompt_behind() {
if $(echo "$(git log HEAD..$(git_current_remote)/$(current_branch) 2> /dev/null)" | grep '^commit' &> /dev/null); then
echo "$ZSH_THEME_GIT_PROMPT_BEHIND"
fi
}
# Formats prompt string for current git commit short SHA # Formats prompt string for current git commit short SHA
function git_prompt_short_sha() { function git_prompt_short_sha() {
SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
@ -31,7 +37,7 @@ function git_prompt_long_sha() {
} }
# Get the status of the working tree # Get the status of the working tree
git_prompt_status() { function git_prompt_status() {
INDEX=$(git status --porcelain 2> /dev/null) INDEX=$(git status --porcelain 2> /dev/null)
STATUS="" STATUS=""
if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
@ -60,3 +66,12 @@ git_prompt_status() {
fi fi
echo $STATUS echo $STATUS
} }
function git_current_remote() {
remote=$(git config --get "branch.$(current_branch).remote")
if [ -z "$remote" ]; then
echo 'origin'
else
echo "$remote"
fi
}