Created
May 9, 2012 12:21
-
-
Save marcgg/2644116 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Content for .zsh: | |
######### | |
# COLORS | |
######### | |
autoload -U colors | |
colors | |
setopt prompt_subst | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" | |
# Text to display if the branch is dirty | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} *%{$reset_color%}" | |
# Text to display if the branch is clean | |
ZSH_THEME_GIT_PROMPT_CLEAN="" | |
######### | |
# PROMPT | |
######### | |
PROMPT='%{$fg[cyan]%}${current_path}%{$fg[white]%}%{$fg[white]%}[$(~/bin/git-cwd-info)%{$reset_color%}] $ ' | |
---------------- | |
~[] $ cat ~/bin/git-cwd-info | |
GIT_REPO_PATH=`git rev-parse --git-dir 2>/dev/null` | |
if [[ $GIT_REPO_PATH != '' && $GIT_REPO_PATH != '~' && $GIT_REPO_PATH != "$HOME/.git" ]]; then | |
GIT_BRANCH=`git symbolic-ref -q HEAD | sed 's/refs\/heads\///'` | |
GIT_COMMIT_ID=`git rev-parse --short HEAD 2>/dev/null` | |
GIT_MODE="" | |
if [[ -e "$GIT_REPO_PATH/BISECT_LOG" ]]; then | |
GIT_MODE=" +bisect" | |
elif [[ -e "$GIT_REPO_PATH/MERGE_HEAD" ]]; then | |
GIT_MODE=" +merge" | |
elif [[ -e "$GIT_REPO_PATH/rebase" || -e "$GIT_REPO_PATH/rebase-apply" || -e "$GIT_REPO_PATH/rebase-merge" || -e "$GIT_REPO_PATH/../.dotest" ]]; then | |
GIT_MODE=" +rebase" | |
fi | |
GIT_DIRTY="" | |
if [[ "$GIT_REPO_PATH" != '.' && `git ls-files -m` != "" ]]; then | |
GIT_DIRTY=" %{[90m%}✗%{[0m%}" | |
fi | |
if [ $GIT_BRANCH = "master" ]; then | |
echo "%{[31m%}$GIT_BRANCH$GIT_MODE$GIT_DIRTY" | |
elif [ $GIT_BRANCH = "development" ]; then | |
echo "%{[32m%}$GIT_BRANCH$GIT_MODE$GIT_DIRTY" | |
else | |
echo "%{[33m%}$GIT_BRANCH$GIT_MODE$GIT_DIRTY" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment