Last active
October 3, 2018 02:20
-
-
Save 17twenty/c7da6a6ab4c24cb7d152870ad801d6a5 to your computer and use it in GitHub Desktop.
My bash_profile for MacOS
This file contains 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
if [ -f /usr/local/etc/bash_completion ]; then | |
. /usr/local/etc/bash_completion | |
fi | |
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
unset color_prompt force_color_prompt | |
# If this is an xterm set the title to user@host:dir | |
case "$TERM" in | |
xterm*|rxvt*) | |
PS1="\[\e]0;\u@\h: \w\a\]$PS1" | |
;; | |
*) | |
;; | |
esac | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxBxDxCxegedabagacad | |
alias ls='ls -GFh' | |
function git_color () | |
{ | |
# Get the status of the repo and chose a color accordingly | |
local STATUS=`git status 2>&1` | |
if [[ "$STATUS" == *'Not a git repository'* ]] | |
then | |
echo "" | |
else | |
if [[ "$STATUS" != *'working directory clean'* ]] | |
then | |
# red if need to commit | |
echo -e '\033[0;31m' | |
else | |
if [[ "$STATUS" == *'Your branch is ahead'* ]] | |
then | |
# yellow if need to push | |
echo -e '\033[0;33m' | |
else | |
# else cyan | |
echo -e '\033[0;36m' | |
fi | |
fi | |
fi | |
} | |
function diary { | |
[ -d ~/diary ] || mkdir ~/diary | |
vim ~/diary/$(date +%Y-%m-%d).md | |
} | |
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "("${ref#refs/heads/}")" | |
} | |
export -f git_color | |
export -f diary | |
export -f parse_git_branch | |
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \[$(git_color)\]$(parse_git_branch)\[\033[00m\] \$ ' | |
export GOPATH=$HOME/go | |
export PATH=$PATH:$GOPATH/bin/:/Users/nickglynn/flutter/bin/ | |
export CDPATH=.:$GOPATH/src/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment