Skip to content

Instantly share code, notes, and snippets.

@jacobroufa
Created September 15, 2015 18:36
Show Gist options
  • Select an option

  • Save jacobroufa/a614ac18a5aca7d24c7a to your computer and use it in GitHub Desktop.

Select an option

Save jacobroufa/a614ac18a5aca7d24c7a to your computer and use it in GitHub Desktop.
# .bash_profile
umask 002
# Add git completion
if [ -f ~/git-completion.bash ]; then
source ~/git-completion.bash
fi
# Add __git_ps1
if [ -f ~/.git-prompt.sh ]; then
source ~/.git-prompt.sh
fi
export LS_OPTIONS='--color=auto'
export CLICOLOR=1
export LSCOLORS=gxfxbEaEBxxEhEhBaDaCaD
# Function that returns the short hash of the current git repository
get_sha ()
{
git rev-parse --short HEAD 2> /dev/null
}
MAGENTA="\[\033[0;35m\]"
YELLOW="\[\033[0;33m\]"
BLUE="\[\033[34m\]"
LIGHT_GRAY="\[\033[0;37m\]"
CYAN="\[\033[0;36m\]"
GREEN="\[\033[0;32m\]"
DEFAULT="\[\033[0m\]"
# export PS1=$LIGHT_GRAY"\u@\h"'$(
# if [[ $(__git_ps1) =~ \*\)$ ]]
# # a file has been modified but not added
# then echo "'$YELLOW'"$(__git_ps1 " (%s $(get_sha))")
# elif [[ $(__git_ps1) =~ \+\)$ ]]
# # a file has been added, but not commited
# then echo "'$MAGENTA'"$(__git_ps1 " (%s $(get_sha))")
# # the state is clean, changes are commited
# else echo "'$CYAN'"$(__git_ps1 " (%s $(get_sha))")
# fi)'$BLUE" \w"$GREEN": "
# Set the PS1 prompt (with colors).
# Based on http://www-128.ibm.com/developerworks/linux/library/l-tip-prompt/
# And http://networking.ringofsaturn.com/Unix/Bash-prompts.php .
export PS1=$LIGHT_GRAY'$(__git_ps1 "[%s $(get_sha)] ")'$BLUE'\h'$DEFAULT':'$MAGENTA'\W'$LIGHT_GRAY' $ '$DEFAULT
# Set the default editor to vim.
export EDITOR=mvim
# Avoid succesive duplicates in the bash command history.
export HISTCONTROL=ignoredups
# Append commands to the bash command history file (~/.bash_history)
# instead of overwriting it.
shopt -s histappend
# Append commands to the history every time a prompt is shown,
# instead of after closing the session.
export PROMPT_COMMAND='history -a'
# Add brew and global composer binaries to $PATH
PHP_DIR="$(brew --prefix Homebrew/php/php55)/bin"
COMPOSER_DIR="~/.composer/vendor/bin"
ANDROID_PLATFORM="~/Repos/android-sdk-macosx/platform-tools"
ANDROID_TOOLS="~/Repos/android-sdk-macosx/tools"
export ANDROID_HOME=~/Repos/android-sdk-macosx
export PATH="$PHP_DIR:$COMPOSER_DIR:$ANDROID_PLATFORM:$ANDROID_TOOLS:$PATH"
# Add tab completion to bash shell for commonly used directories
export CDPATH=".:~:~/Repos"
# To be perfectly honest, I don't know why this is here...
export PHP_AUTOCONF="/usr/local/bin/autoconf"
# ZZZZZZZZZZZZZZ
source /Users/jacobroufa/Repos/z/z.sh
# `md` is a shortcut for making a directory then `cd`-ing into it
md ()
{
mkdir -p "$@"
eval cd "\"\$$#\""
}
# Add aliases
if [ -f ~/.bash_aliases ]; then
source ~/.bash_aliases
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment