Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
my current working .profile on MacOS
########### alias' ###################
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# -> Prevents accidentally clobbering files.
alias mkdir='mkdir -p'
alias h='history'
alias j='jobs -l'
alias which='type -a'
alias ..='cd ..'
# Pretty-print of some PATH variables:
alias path='echo -e ${PATH//:/\\n}'
alias libpath='echo -e ${LD_LIBRARY_PATH//:/\\n}'
alias du='du -kh' # Makes a more readable output.
alias df='df -kh'
alias ls="ls -lgFph"
alias la="ls -lagFph"
alias accurev="/Applications/AccuRev/bin/accurev"
alias repos="cd /Volumes/Mac\ HD/repos"
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
########## color #######################
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
#ALERT=${BWhite}${On_Red} # Bold White on red background
# Test connection type:
# if [ -n "${SSH_CONNECTION}" ]; then
# CNX=${Green} # Connected on remote machine, via ssh (good).
# elif [[ "${DISPLAY%%:0*}" != "" ]]; then
# CNX=${ALERT} # Connected on remote machine, not via ssh (bad).
# else
# CNX=${BCyan} # Connected on local machine.
# fi
#
# Setup a red prompt for root and a green one for users.
# NORMAL="\[\e[0m\]"
# RED="\[\e[1;31m\]"
# GREEN="\[\e[1;32m\]"
# if [[ $EUID == 0 ]] ; then
# PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL"
# else
# PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
#fi
########## functions #####################
export HISTCONTROL=ignoredups
# Responsive Prompt
# parse_git_branch() {
# if [[ -f "$BASH_COMPLETION_DIR/git-completion.bash" ]]; then
# branch=`__git_ps1 "%s"`
# else
# ref=$(git-symbolic-ref HEAD 2> /dev/null) || return
# branch="${ref#refs/heads/}"
# fi
# if [[ `tput cols` -lt 110 ]]; then
# branch=`echo $branch | sed s/feature/f/1`
# branch=`echo $branch | sed s/hotfix/h/1`
# branch=`echo $branch | sed s/release/\r/1`
# branch=`echo $branch | sed s/master/mstr/1`
# branch=`echo $branch | sed s/develop/dev/1`
# fi
# if [[ $branch != "" ]]; then
# if [[ $(git status 2> /dev/null | tail -n1) == "nothing to commit, working directory clean" ]]; then
# echo "${GREEN}$branch${COLOREND} "
# else
# echo "${RED}$branch${COLROEND} "
# fi
# fi
# }
# working_directory() {
# dir=`pwd`
# in_home=0
# if [[ `pwd` =~ ^"$HOME"(/|$) ]]; then
# dir="~${dir#$HOME}"
# in_home=1
# fi
# workingdir=""
# if [[ `tput cols` -lt 110 ]]; then
# first="/`echo $dir | cut -d / -f 2`"
# letter=${first:0:2}
# if [[ $in_home == 1 ]]; then
# letter="~$letter"
# fi
# proj=`echo $dir | cut -d / -f 3`
# beginning="$letter/$proj"
# end=`echo "$dir" | rev | cut -d / -f1 | rev`
# if [[ $proj == "" ]]; then
# workingdir="$dir"
# elif [[ $proj == "~" ]]; then
# workingdir="$dir"
# elif [[ $dir =~ "$first/$proj"$ ]]; then
# workingdir="$beginning"
# elif [[ $dir =~ "$first/$proj/$end"$ ]]; then
# workingdir="$beginning/$end"
# else
# workingdir="$beginning/…/$end"
# fi
# else
# workingdir="$dir"
# fi
# echo -e "${YELLOW}$workingdir${COLOREND} "
# }
# parse_remote_state() {
# remote_state=$(git status -sb 2> /dev/null | grep -oh "\[.*\]")
# if [[ "$remote_state" != "" ]]; then
# out="${BLUE}[${COLOREND}"
# if [[ "$remote_state" == *ahead* ]] && [[ "$remote_state" == *behind* ]]; then
# behind_num=$(echo "$remote_state" | grep -oh "behind \d*" | grep -oh "\d*$")
# ahead_num=$(echo "$remote_state" | grep -oh "ahead \d*" | grep -oh "\d*$")
# out="$out${RED}$behind_num${COLOREND},${GREEN}$ahead_num${COLOREND}"
# elif [[ "$remote_state" == *ahead* ]]; then
# ahead_num=$(echo "$remote_state" | grep -oh "ahead \d*" | grep -oh "\d*$")
# out="$out${GREEN}$ahead_num${COLOREND}"
# elif [[ "$remote_state" == *behind* ]]; then
# behind_num=$(echo "$remote_state" | grep -oh "behind \d*" | grep -oh "\d*$")
# out="$out${RED}$behind_num${COLOREND}"
# fi
# out="$out${BLUE}]${COLOREND}"
# echo "$out "
# fi
# }
# prompt() {
# if [[ $? -eq 0 ]]; then
# exit_status="${BLUE}▸${COLOREND} "
# else
# exit_status="${RED}▸${COLOREND} "
# fi
# PS1="$(working_directory)$(parse_git_branch)$(parse_remote_state)$exit_status"
# }
#PROMPT_COMMAND=prompt
pathappend () {
pathremove $1 $2
local PATHVARIABLE=${2:-PATH}
export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1"
}
pathremove () {
local IFS=':'
local NEWPATH
local DIR
local PATHVARIABLE=${2:-PATH}
for DIR in ${!PATHVARIABLE} ; do
if [ "$DIR" != "$1" ] ; then
NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
fi
done
export $PATHVARIABLE="$NEWPATH"
}
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
#rbenv init -
#pyenv init -
eval "$(pyenv init -)"
eval "$(rbenv init -)"
source ~/.git-completion.sh
source ~/.git-prompt.sh
#PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
GIT_PS1_SHOWUPSTREAM="auto"
GIT_PS1_SHOWDIRTYSTATE="true"
GIT_PS1_SHOWCOLORHINTS="true"
#PROMPT_COMMAND='__git_ps1 "\u@\h:\w" "\\\$ "'
PROMPT_COMMAND='__git_ps1 "\u@\h:\w" " ->> "'
# Setting PATH for Python 3.3
# The orginal version is saved in .profile.pysave
#PATH="/Library/Frameworks/Python.framework/Versions/3.3/bin:${PATH}"
#export PATH
#PS1="(\A \u@\h \w) > "
@ceeblet

This comment has been minimized.

Copy link
Owner Author

ceeblet commented Mar 7, 2015

commented out a lot of stuff due to experimentation. kept it there for reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.