Skip to content

Instantly share code, notes, and snippets.

@stilist
Last active October 13, 2015 10:08
Show Gist options
  • Save stilist/f445483bd4f9bfc2ca35 to your computer and use it in GitHub Desktop.
Save stilist/f445483bd4f9bfc2ca35 to your computer and use it in GitHub Desktop.
Bash stuff!
export EDITOR=nano
# http://git-blame.blogspot.com/2012/02/anticipating-git-1710.html
export GIT_MERGE_AUTOEDIT=no
export CC=clang
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
###############################################################################
# Load `$PATH`
if [ -f ~/.bashrc ] ; then
source ~/.bashrc
fi
# https://github.com/stilist/shell_enhancements
for file in ~/shell_enhancements/*.sh ; do
[ -r "$file" ] && [ -f "$file" ] && source "$file";
done;
unset file;
generate_ps1 () {
# http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
local red="\[\e[31m\]"
local green="\[\e[32m\]"
local yellow="\[\e[1;33m\]"
local cyan="\[\e[36m\]"
local light_gray="\[\e[37m\]"
local blank="\[\e[0m\]"
local path="$red\w$blank"
local timestamp="$cyan\D{%m.%d.%y @ %k:%M}$blank"
local prompt="$light_gray\$$blank"
# `\$(foo)` construct results in lazy evaluation. Without it,
# `branch_name` will only eval once, at the moment this script loads.
local branch_name="\$(git_current_branch)"
local branch=""
if [ -n "$branch_name" ] ; then
branch=" $yellow$branch_name$blank"
fi
echo "\n$path $timestamp$branch\n$prompt "
}
export PS1=$(generate_ps1)
export SHELL=`which bash`
# system paths
export PATH="/usr/local/bin:/bin:/usr/sbin:/sbin:$HOME/bin:$PATH"
# Heroku toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
# MySQL
export PATH="/usr/local/mysql/bin:$PATH"
# node.js
export PATH="$HOME/local/bin:$PATH"
# PostgreSQL
export PATH="/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH"
# Python
export PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Python/2.7/site-packages/:$PATH"
# rbenv
export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
# up and down arrows do incremental history search
"\e[A": history-search-backward
"\e[B": history-search-forward
# fix need to double-tap for autocompleting symlink directories
# http://blogs.ethzero.org/2007/10/bash-and-tab-completion-of-symlinks-to.html
set mark-directories On
set mark-symlinked-directories On
@boek
Copy link

boek commented Sep 13, 2013

For people that are having git branch issues replace line #18 of .bash_profile with

git rev-parse --symbolic-full-name --abbrev-ref HEAD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment