Last active
August 11, 2017 15:53
-
-
Save MatthewRalston/88217aec1498dc3b61b1 to your computer and use it in GitHub Desktop.
Mac 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
#set -x | |
## | |
# Your previous /Users/Matthew/.bash_profile file was backed up as /Users/Matthew/.bash_profile.macports-saved_2013-04-01_at_23:07:38 | |
## | |
export PATH=/usr/local/bin/:$PATH | |
# MacPorts Installer addition on 2013-04-01_at_23:07:38: adding an appropriate PATH variable for use with MacPorts. | |
export PATH=/opt/local/bin:/opt/local/sbin:/Users/Matthew/Documents/Bash_scripts:/Applications/circos-0.66/bin/:$PATH | |
# Finished adapting your PATH environment variable for use with MacPorts. | |
export PERL5LIB="$HOME/SourceCache/bioperl-live:$PERL5LIB" | |
source ~/.profile | |
#source ~/.bashrc | |
# Setting PATH for Python 3.3 | |
# The orginal version is saved in .bash_profile.pysave | |
PATH="/Library/Frameworks/Python.framework/Versions/3.3/bin:${PATH}" | |
PATH=$PATH:/Users/Matthew/home/bin | |
export PATH | |
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
# don't put duplicate lines in the history. See bash(1) for more options | |
export HISTCONTROL=ignoredups | |
#alias rm='echo "rm is disabled, use trash or /bin/rm instead/."' | |
export LS_OPTS='--cotor=auto' | |
alias ls='ls ${LS_OPTS}' | |
alias ls='ls -l -h' | |
alias ..='cd ..' | |
alias ...='cd ../..' | |
alias ....='cd ../../..' | |
alias .....='cd ../../../..' | |
alias diskspace="du -S | sort -n -r |more" | |
# Shows even more permissions | |
alias lsd="ls -alF | grep /$" | |
alias ll='ls -alh' | |
#Shows hidden files such as bashrc | |
alias la='ls -A' | |
#shows permissions | |
alias l='ls -CFlh' | |
# Sorts files by size | |
alias sortbysize="ls -s | sort -n" | |
alias psgrep="ps aux | grep" | |
alias please="sudo $(history -p \!\!)" | |
alias RELOAD=". ~/.bash_profile" | |
# COLORS!! | |
export TERM=xterm-color | |
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32' | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxCxDxBxegedabagacad | |
export COLOR_NC='\e[0m' # No Color | |
export COLOR_WHITE='\e[1;37m' | |
export COLOR_BLACK='\e[0;30m' | |
export COLOR_BLUE='\e[0;34m' | |
export COLOR_LIGHT_BLUE='\e[1;34m' | |
export COLOR_GREEN='\e[0;32m' | |
export COLOR_LIGHT_GREEN='\e[1;32m' | |
export COLOR_CYAN='\e[0;36m' | |
export COLOR_LIGHT_CYAN='\e[1;36m' | |
export COLOR_RED='\e[0;31m' | |
export COLOR_LIGHT_RED='\e[1;31m' | |
export COLOR_PURPLE='\e[0;35m' | |
export COLOR_LIGHT_PURPLE='\e[1;35m' | |
export COLOR_BROWN='\e[0;33m' | |
export COLOR_YELLOW='\e[1;33m' | |
export COLOR_GRAY='\e[0;30m' | |
export COLOR_LIGHT_GRAY='\e[0;37m' | |
export UC=$COLOR_YELLOW # user's color | |
[ $UID -eq "0" ] && export UC=$COLOR_RED # root's color | |
#export PS1="\[${UC}\]\u@\h: \[${COLOR_GREEN}\]\$(vcprompt)| \[${COLOR_LIGHT_CYAN}\]\w >" | |
export PS1="$(gitmode -s)" | |
#export PS1="$TITLEBAR\n\[${UC}\]\u \[${COLOR_LIGHT_BLUE}\]\${PWD} \[${COLOR_BLACK}\]\$(vcprompt) \n\[${COLOR_LIGHT_GREEN}\]→\[${COLOR_NC}\] " | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
# added by Anaconda 1.8.0 installer | |
#export PATH="//anaconda/bin:$PATH" | |
# Docker | |
$(boot2docker shellinit 2> /dev/null) | |
export DOCKER_TLS_VERIFY=1 | |
export DOCKER_CERT_PATH=/Users/Matthew/.boot2docker/certs/boot2docker-vm | |
if [ -f /usr/local/bin/screenfetch ]; then screenfetch; fi | |
# G I T / T W I G | |
[[ -s ~/.twig/twig-completion.bash ]] && source ~/.twig/twig-completion.bash | |
# PYENV | |
PYTHONPATH=/Users/Matthew/.pyenv/versions/matts_2.7.8/lib/python2.7/site-packages | |
export PYENV_ROOT="$HOME/.pyenv" | |
export PATH=$PYENV_ROOT/bin:$PATH | |
eval "$(pyenv init -)" | |
eval export PYENV_VIRTUALENV_INIT=1; | |
_pyenv_virtualenv_hook() { | |
if [ -n "$PYENV_ACTIVATE" ]; then | |
if [ "$(pyenv version-name)" = "system" ]; then | |
pyenv deactivate --no-error --verbose | |
return 0 | |
fi | |
if [ "$PYENV_ACTIVATE" != "$(pyenv prefix)" ]; then | |
if pyenv deactivate --no-error --verbose; then | |
pyenv activate --no-error --verbose || unset PYENV_DEACTIVATE | |
else | |
pyenv activate --no-error --verbose | |
fi | |
fi | |
else | |
if [ -z "$VIRTUAL_ENV" ] && [ "$PYENV_DEACTIVATE" != "$(pyenv prefix)" ]; then | |
pyenv activate --no-error --verbose | |
fi | |
fi | |
}; | |
if ! [[ "$PROMPT_COMMAND" =~ _pyenv_virtualenv_hook ]]; then | |
PROMPT_COMMAND="_pyenv_virtualenv_hook;$PROMPT_COMMAND"; | |
fi |
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
#!/bin/bash | |
export GITMODE=$HOME/.gitmode | |
HELP=0 | |
UNSET=0 | |
START=0 | |
if [[ $# > 0 ]] | |
then | |
key="$1" | |
case $key in | |
-h|--help) | |
HELP=1 | |
;; | |
-u|--unset) | |
UNSET=1 | |
;; | |
-s|--start) | |
START=1 | |
;; | |
esac | |
shift | |
fi | |
if [ $HELP == 1 ];then | |
echo "Usage:" | |
echo " gitmode [-s|--start] [-u|unset]" | |
echo "Options:" | |
echo " -s|--start Echo a PS1 which will show version control information in terminal prompt" | |
echo " -u|--unset Echo a PS1 which will NOT show version control information in terminal prompt" | |
exit 2 | |
fi | |
gitmode="\[${UC}\]\u@\h \[${COLOR_LIGHT_GRAY}\]\$(vcprompt)\[${COLOR_LIGHT_GREEN}\]\$(vcprompt -f %a)\[${COLOR_RED}\]\$(vcprompt -f %m) \[${COLOR_LIGHT_CYAN}\]\w>" | |
speedmode="\[${UC}\]\u@\h \[${COLOR_LIGHT_CYAN}\]\w>" | |
if [[ $UNSET == 1 ]]; then | |
if [[ -e $GITMODE ]]; then | |
rm $GITMODE | |
fi | |
elif [[ $START == 1 ]]; then | |
if [ ! -e $GITMODE ] | |
then | |
touch $GITMODE | |
fi | |
fi | |
if [[ -e $GITMODE ]]; then | |
#echo gitmode active | |
echo $gitmode | |
elif [[ ! -e $GITMODE ]]; then | |
#echo gitmode inactive | |
echo $speedmode | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Terminal prompt VCS information can be toggled by using either:
The gitmode script depends upon vcprompt script.
What do you think @moorer?