Created
September 24, 2011 21:34
-
-
Save kwilczynski/1239895 to your computer and use it in GitHub Desktop.
To set xterm-256color and nice prompt for git on Ubuntu
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
# Useful but slow against very large repositories. | |
GIT_PS1_SHOWDIRTYSTATE=true | |
# Use __git_ps1 function from git contributed package to do the work. | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[1;33m\]$(__git_ps1 " (%s)")\[\033[00m\]\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1 " (%s")\$ ' | |
fi | |
# Set 256 colour terminal when the definition is present. | |
if [ -e /usr/share/terminfo/x/xterm-256color ]; then | |
TERM='xterm-256color' | |
else | |
TERM='xterm-color' | |
fi | |
# Set a fancy prompt (non-color, unless we know we "want" colour). | |
case "$TERM" in | |
xterm-color) color_prompt=yes;; | |
xterm-256color) color_prompt=yes;; | |
esac | |
# Typing "git" all the time is simply too much work. | |
alias g='git' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment