Skip to content

Instantly share code, notes, and snippets.

@moorage
Created December 13, 2014 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moorage/1496512d980c6d54b996 to your computer and use it in GitHub Desktop.
Save moorage/1496512d980c6d54b996 to your computer and use it in GitHub Desktop.
rvm and git and directory in bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
### BEGIN: history bash shell useful settings ###
export HISTCONTROL=ignoredups # Ignores dupes in the history
shopt -s checkwinsize # After each command, checks the windows size and changes lines and columns
# shows the history commands you use most, it's useful to show you what you should create aliases for
alias historyprofile="history | awk '{print $2}' | awk 'BEGIN{FS=\"|\"}{print $1}' | sort | uniq -c | sort -n | tail -n 20 | sort -nr"
### END ###
### BEGIN: bash completion settings ###
# load bash completion
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# bash completion settings (actually, these are readline settings)
bind "set completion-ignore-case on" # note: bind is used instead of setting these in .inputrc. This ignores case in bash completion
bind "set bell-style none" # No bell, because it's damn annoying
bind "set show-all-if-ambiguous On" # this allows you to automatically show completion without double tab-ing
### END ###
### BEGIN: terminal color env vars/function ###
export CLICOLOR=1
export LSCOLORS="ExGxFxdxCxDxDxhbadExEx"
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
# customize the colors in terminal preferences to your liking
# export TERM='xterm-256color'
export COLOR_NC='\[\033[0m\]' # No Color
export COLOR_BLACK='\[\033[0;30m\]'
export COLOR_BRIGHT_BLACK='\[\033[1;30m\]'
export COLOR_RED='\[\033[0;31m\]'
export COLOR_BRIGHT_RED='\[\033[1;31m\]'
export COLOR_GREEN='\[\033[0;32m\]'
export COLOR_BRIGHT_GREEN='\[\033[1;32m\]'
export COLOR_YELLOW='\[\033[1;33m\]'
export COLOR_BRIGHT_YELLOW='\[\033[1;33m\]'
export COLOR_BLUE='\[\033[0;34m\]'
export COLOR_BRIGHT_BLUE='\[\033[1;34m\]'
export COLOR_PURPLE='\[\033[0;35m\]'
export COLOR_BRIGHT_PURPLE='\033[1;35m\]'
export COLOR_CYAN='\[\033[0;36m\]'
export COLOR_BRIGHT_CYAN='\[\033[1;36m\]'
export COLOR_WHITE='\[\033[0;37m\]'
export COLOR_BRIGHT_WHITE='\[\033[1;37m\]'
alias list_colors="set | egrep '^COLOR_\\w*'" # lists all the colors & values from above
# call this function from prompt then customize your terminal colors how you like in the terminal/preference/settings
# colors will change so you can see what they look like in the terminal
display_colors (){
echo -e "\033[0mCOLOR_NC\tCOLOR_NO_COLOR"
echo -e "\033[0;30mCOLOR_BLACK\t\033[1;30mCOLOR_BRIGHT_BLACK"
echo -e "\033[0;31mCOLOR_RED\t\033[1;31mCOLOR_BRIGHT_RED"
echo -e "\033[0;32mCOLOR_GREEN\t\033[1;32mCOLOR_BRIGHT_GREEN"
echo -e "\033[0;33mCOLOR_YELLOW\t\033[1;33mCOLOR_BRIGHT_YELLOW"
echo -e "\033[0;34mCOLOR_BLUE\t\033[1;34mCOLOR_BRIGHT_BLUE"
echo -e "\033[0;35mCOLOR_PURPLE\t\033[1;35mCOLOR_BRIGHT_PURPLE"
echo -e "\033[0;36mCOLOR_CYAN\t\033[1;36mCOLOR_BRIGHT_CYAN"
echo -e "\033[0;37mCOLOR_WHITE\t\033[1;37mCOLOR_BRIGHT_WHITE"
}
### END ###
### BEGIN: load bashrc ###
# make sure nothing is being loaded again that's already loaded above
# last export PATH happens in bashrc
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
### END ###
### BEGIN: reset path to original ###
# easily rest path env to original
export PATH_ORIGINAL="$PATH"
alias reset_path='export PATH=$PATH_ORIGINAL'
### END ###
### BEGIN: git autocompletion ###
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
### END ###
### BEGIN: format terminal PS display settings ###
# current working directory prompt
PS1="${COLOR_NC}${COLOR_BRIGHT_BLACK}[${COLOR_NC}${COLOR_GREEN}\w${COLOR_NC}${COLOR_BRIGHT_BLACK} "
# git prompt
PS1="$PS1${COLOR_NC}${COLOR_BRIGHT_BLACK} ${COLOR_NC}${COLOR_CYAN}git:\W\$(__git_ps1 \"(%s)\")${COLOR_NC}${COLOR_BRIGHT_BLACK} "
# rvm prompt
PS1="$PS1${COLOR_NC}${COLOR_BRIGHT_BLACK} ${COLOR_NC}${COLOR_BRIGHT_PURPLE}rvm:\$(~/.rvm/bin/rvm-prompt)${COLOR_NC}${COLOR_BRIGHT_BLACK}]\n"
PS1="$PS1${COLOR_NC}${COLOR_BRIGHT_BLACK}[${COLOR_NC}${COLOR_RED}\T${COLOR_NC}${COLOR_BRIGHT_BLACK}] $ ${COLOR_NC}"
export PS1
# prompt for continuing commands
PS2="${COLOR_NC}${COLOR_BRIGHT_BLACK} > ${COLOR_NC}"
export PS2
### END ###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment