Created
August 18, 2011 20:18
-
-
Save jrasanen/1155078 to your computer and use it in GitHub Desktop.
My bashrc
This file contains 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
# ~/.bashrc | |
# | |
# Author: incidence <[email protected]> | |
# | |
# This file requires git and sed. | |
# On osx you have to change root term from /bin/sh to /bin/bash | |
# you can do that by running: sudo chsh root | |
# | |
# OSX Lion fixes | |
export LC_CTYPE=en_US.UTF-8 | |
export LC_ALL=en_US.UTF-8 | |
export LC_LANG=en_US.UTF-8 | |
# Postgres + homebrew before macports and /usr/bin | |
PATH=/usr/local/bin:/usr/local/sbin/:$PATH:/usr/local/pgsql/bin | |
# Macports is in my homedir | |
PATH=$PATH:~/macports/bin/:/usr/local/bin | |
# Python VE, probably should be the last one | |
PATH=$PATH:/Users/incidence/tmp/env/bin | |
# Various paths | |
PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin | |
export PATH | |
# Postgres stuff | |
PGDATA=/usr/local/var/postgres | |
export PGDATA | |
# Define default hostname | |
HOSTNAME="localhost" | |
# Get hostname from custom location | |
if [ -f /usr/local/etc/hostname ];then | |
. /usr/local/etc/hostname | |
fi | |
# Custom bash prompt via kirsle.net/wizards/ps1.html | |
PS1="\[$(tput bold)\]\[$(tput setaf 5)\]\w\n\[$(tput setaf 7)\]\u at $HOSTNAME \[$(tput sgr0)\]" | |
# Sources | |
if [[ $EUID -ne 0 ]]; then | |
source ~/.git-completion.bash | |
fi | |
# Aliases | |
alias gco='git co' | |
alias gci='git ci' | |
alias grb='git rb' | |
alias home="ssh [email protected]" | |
alias antimaterial="ssh [email protected]" | |
alias ls="ls -G" | |
alias ll="ls -G -l" | |
alias l="ls -G -l" | |
alias la="ls -G -la" | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
alias updatedb="sudo /usr/libexec/locate.updatedb" | |
# MPD | |
alias startmpd="mpd /usr/local/etc/mpd.conf" | |
alias stopmpd="kill `pidof mpd`" | |
alias killmpd="kill -9 `pidof mpd`" | |
alias refreshdb="rm ~/.mpd/*.db" | |
# Try to make less more binary friendly | |
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" | |
# Append to history file | |
shopt -s histappend | |
# Update win size, columns/rows if necessary | |
shopt -s checkwinsize | |
# Enables colours on osx term | |
export CLICOLOR=1 | |
# No duplicates for midnight commander etc | |
HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups | |
# Ignore spaces and dupes on bash | |
HISTCONTROL=ignoreboth | |
if [[ $EUID -ne 0 ]]; then | |
# Git magic | |
parse_git_branch () | |
{ | |
git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)#(git::\1)#' | |
} | |
# Add git branch name to PS1 | |
export PS1="$PS1\$(parse_git_branch)\$ " | |
else | |
# Root | |
export PS1="\[$(tput bold)\]\[$(tput setaf 1)\]\u:\[$(tput setaf 7)\]\w # \[$(tput sgr0)\]" | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment