Last active 6 months ago

.bashrc Raw
1if [ "$TERM" != "dumb" ]; then
2 if [[ "$OSTYPE" == "darwin"* ]]; then
3 # For ls colors in Solarized theme
4 # https://github.com/seebi/dircolors-solarized/issues/10
5 export LSCOLORS=gxfxbEaEBxxEhEhBaDaCaD
6 # source git completion
7 if [ -f /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash ]; then
8 . /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
9 fi
10 source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
11 alias ls='ls -G'
12 else
13 eval "`dircolors -b`"
14 alias ls='ls --color=auto'
15 fi
16 function _git_prompt() {
17 local git_status="`git status -unormal 2>&1`"
18 if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then
19 if [[ "$git_status" =~ nothing\ to\ commit ]]; then
20 local ansi=32
21 elif [[ "$git_status" =~ nothing\ added\ to\ commit\ but\ untracked\ files\ present ]]; then
22 local ansi=34
23 else
24 local ansi=33
25 fi
26 echo -n '\[\e[0;33;'"$ansi"'m\]'"$(__git_ps1)"'\[\e[0m\]'
27 fi
28 }
29 function _prompt_command() {
30 PS1="${debian_chroot:+($debian_chroot)}\[\033[01;38m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]`_git_prompt`\$ "
31 }
32 PROMPT_COMMAND=_prompt_command
33fi
34