Created
January 12, 2010 13:13
-
-
Save akio0911/275173 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# git のブランチ名前を表示 | |
_set_env_git_current_branch() { | |
GIT_CURRENT_BRANCH=$( git branch &> /dev/null | grep '^\*' | cut -b 3- ) | |
} | |
_update_rprompt () { | |
if [ "`git ls-files 2>/dev/null`" ]; then | |
RPROMPT="[%~:$GIT_CURRENT_BRANCH]" | |
else | |
RPROMPT="[%~]" | |
fi | |
} | |
precmd() | |
{ | |
_set_env_git_current_branch | |
_update_rprompt | |
} | |
chpwd() | |
{ | |
_set_env_git_current_branch | |
_update_rprompt | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment