Created
February 17, 2019 17:12
-
-
Save loriculberson/0c2d8e9d05cad5af5c9e4c35d731c3c8 to your computer and use it in GitHub Desktop.
Bash Profile
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
| echo "Good morning sunshine!" | |
| #prompt header | |
| function parse_git_branch { | |
| branch=`git rev-parse --abbrev-ref HEAD 2>/dev/null` | |
| if [ "HEAD" = "$branch" ]; then | |
| echo "(no branch)" | |
| else | |
| echo "$branch" | |
| fi | |
| } | |
| function prompt_segment { | |
| # for colours: http://en.wikipedia.org/wiki/ANSI_escape_code#Colors | |
| # change the 37 to change the foreground | |
| # change the 45 to change the background | |
| if [[ ! -z "$1" ]]; then | |
| echo "\[\033[${2:-37};45m\]${1}\[\033[0m\]" | |
| fi | |
| } | |
| function build_mah_prompt { | |
| # time | |
| ps1="$(prompt_segment " \@ ")" | |
| # cwd | |
| ps1="${ps1} $(prompt_segment " \w ")" | |
| # git branch | |
| git_branch=`parse_git_branch` | |
| if [[ ! -z "$git_branch" ]] | |
| then | |
| ps1="${ps1} $(prompt_segment " $git_branch " 32)" | |
| fi | |
| #terminal icon | |
| ps1="${ps1}\n✪ " | |
| echo "$ps1" | |
| } | |
| function set_prompt { | |
| PS1=$(build_mah_prompt) | |
| } | |
| PROMPT_COMMAND='set_prompt' | |
| #PS1=$(build_mah_prompt) | |
| # Git aliases | |
| alias gs="git status" | |
| alias gd="git diff --patience --ignore-space-change" | |
| alias gc="git checkout" | |
| alias gb="git branch" | |
| alias ga="git add" | |
| alias gh="git hist" | |
| alias gr="git remote -v" | |
| alias c="clear" | |
| export NVM_DIR="$HOME/.nvm" | |
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
| [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
| [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
| # Make sure to create .git-completion.bash from https://github.com/git/git/blob/master/contrib/completion/git-completion.bash | |
| source ~/.git-completion.bash | |
| # Add Visual Studio Code (code) | |
| export PATH=$PATH:/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment