.bashrc
· 1.4 KiB · Bash
Raw
if [ "$TERM" != "dumb" ]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
# For ls colors in Solarized theme
# https://github.com/seebi/dircolors-solarized/issues/10
export LSCOLORS=gxfxbEaEBxxEhEhBaDaCaD
# source git completion
if [ -f /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash ]; then
. /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
fi
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
alias ls='ls -G'
else
eval "`dircolors -b`"
alias ls='ls --color=auto'
fi
function _git_prompt() {
local git_status="`git status -unormal 2>&1`"
if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then
if [[ "$git_status" =~ nothing\ to\ commit ]]; then
local ansi=32
elif [[ "$git_status" =~ nothing\ added\ to\ commit\ but\ untracked\ files\ present ]]; then
local ansi=34
else
local ansi=33
fi
echo -n '\[\e[0;33;'"$ansi"'m\]'"$(__git_ps1)"'\[\e[0m\]'
fi
}
function _prompt_command() {
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;38m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]`_git_prompt`\$ "
}
PROMPT_COMMAND=_prompt_command
fi
| 1 | if [ "$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 |
| 33 | fi |
| 34 |