Permalink
Browse files

start using git-completion.bash

  • Loading branch information...
1 parent aa61d69 commit 1001462c99904b3ecf74907262fececd283677d5 @stesla committed Nov 10, 2011
Showing with 16 additions and 12 deletions.
  1. +16 −12 home/.bashrc
View
@@ -37,18 +37,6 @@ PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:
[[ -d "$HOME/.cabal/bin" ]] && PATH="$HOME/.cabal/bin:$PATH"
export PATH
-# Set the prompt. We do this here because not all interactive shells are login
-# shells, and some terminals (e.g. xterm) don't eval ~/.bash_profile.
-
-function parse_git_dirty {
- [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
-}
-function parse_git_branch {
- git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
-}
-
-export PS1="[\u@\h:\w]\$(parse_git_branch)\\$ "
-
export GOROOT=$HOME/go
# Preferred utility programs.
@@ -69,6 +57,22 @@ shopt -s no_empty_cmd_completion # Do not complete on nothing.
export HISTCONTROL=ignoredups
export HISTIGNORE="&:[bf]g:exit:clear"
+if [ -d "/usr/local/etc/bash_completion.d" ]; then
+ for i in /usr/local/etc/bash_completion.d/*; do
+ source $i
+ done
+fi
+
+if type -t __git_ps1; then
+ export GIT_PS1_SHOWDIRTYSTATE=true
+ export GIT_PS1_SHOWSTASHSTATE=true
+ export GIT_PS1_SHOWUNTRACKEDFILES=true
+ export GIT_PS1_SHOWUPSTREAM="auto"
+ export PS1='[\u@\h:\w$(__git_ps1 " (%s)")]$ '
+else
+ export PS1='[\u@\h:\w]$ '
+fi
+
# ruby stuff
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

0 comments on commit 1001462

Please sign in to comment.