Created
April 8, 2014 04:47
-
-
Save jedmund/10091999 to your computer and use it in GitHub Desktop.
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
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
# Turn on advanced bash completion if the file exists | |
if [ -f /usr/local/etc/bash_completion ]; then | |
. /usr/local/etc/bash_completion | |
fi | |
# Locate virtualenvwrapper binary | |
if [ -f ~/.local/bin/virtualenvwrapper.sh ]; then | |
export VENVWRAP=~/.local/bin/virtualenvwrapper.sh | |
fi | |
# Case-insensitive globbing (used in pathname expansion) | |
shopt -s nocaseglob | |
# Append to the Bash history file, rather than overwriting it | |
shopt -s histappend | |
# Autocorrect typos in path names when using `cd` | |
shopt -s cdspell | |
# Add tab completion for `defaults read|write NSGlobalDomain` | |
# You could just use `-g` instead, but I like being explicit | |
complete -W "NSGlobalDomain" defaults | |
# If possible, add tab completion for many more commands | |
[ -f /etc/bash_completion ] && source /etc/bash_completion | |
# Path ------------------------------------------------------------ | |
if [ -d ~/.local/bin ]; then | |
export PATH=~/.local/bin:$PATH | |
fi | |
# Turn on advanced bash completion if the file exists | |
if [ -f /usr/local/etc/bash_completion ]; then | |
. /usr/local/etc/bash_completion | |
fi | |
# Locate virtualenvwrapper binary | |
if [ -f ~/.local/bin/virtualenvwrapper.sh ]; then | |
export VENVWRAP=~/.local/bin/virtualenvwrapper.sh | |
fi | |
# PYTHON ########################################################### | |
if [ ! -z $VENVWRAP ]; then | |
# virtualenvwrapper ------------------------------------------- | |
# make sure env directory exists; else create it | |
[ -d $HOME/sites/env ] || mkdir -p $HOME/sites/env | |
export WORKON_HOME=$HOME/sites/env | |
source $VENVWRAP | |
# virtualenv -------------------------------------------------- | |
export VIRTUALENV_USE_DISTRIBUTE=true | |
# pip --------------------------------------------------------- | |
export PIP_VIRTUALENV_BASE=$WORKON_HOME | |
export PIP_REQUIRE_VIRTUALENV=true | |
export PIP_RESPECT_VIRTUALENV=true | |
export PIP_DOWNLOAD_CACHE=$HOME/.pip/cache | |
fi | |
# HISTORY ########################################################### | |
# don't put duplicate lines in the history. See bash(1) for more options | |
# ... or force ignoredups and ignorespace | |
HISTCONTROL=ignoredups:ignorespace | |
# append to the history file, don't overwrite it | |
shopt -s histappend | |
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | |
HISTSIZE=1000 | |
HISTFILESIZE=2000 | |
# check the window size after each command and, if necessary, | |
# update the values of LINES and COLUMNS. | |
shopt -s checkwinsize | |
# CONNECTIONS ####################################################### | |
# ALIASES ########################################################### | |
alias search='find ~ -type f | grep -i ' | |
## Perform mkdir and cd using a single command | |
function mkdircd () { mkdir -p "$@" && eval cd "\"\$$#\""; } | |
## Navigate up the directory using ..n | |
alias ..="cd .." | |
alias ..2="cd ../.." | |
alias ..3="cd ../../.." | |
alias ..4="cd ../../../.." | |
alias ..5="cd ../../../../.." | |
# Turn on advanced bash completion if the file exists | |
if [ -f /usr/local/etc/bash_completion ]; then | |
. /usr/local/etc/bash_completion | |
fi | |
# GIT ############################################################### | |
# Credentials | |
GIT_AUTHOR_NAME="Linna La" | |
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" | |
git config --global user.name "$GIT_AUTHOR_NAME" | |
GIT_AUTHOR_EMAIL="[email protected]" | |
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL" | |
git config --global user.email "$GIT_AUTHOR_EMAIL" | |
# Shortcuts | |
alias gs='git status ' | |
alias ga='git add ' | |
alias gb='git branch ' | |
alias gc='git commit' | |
alias gd='git diff' | |
alias gm='git merge ' | |
alias go='git checkout ' | |
alias gk='gitk --all&' | |
alias gx='gitx --all' | |
alias pull='git pull origin ' | |
alias push='git push origin ' | |
alias rebase='git pull --rebase origin ' | |
function sync { pull $1; push $1; } | |
export -f sync | |
function gl { | |
git --no-pager log --graph --pretty=tformat:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --max-count=$1 | |
} | |
export -f gl | |
alias sm='sync master' | |
alias got='git ' | |
alias get='git ' | |
# COLORS ############################################################ | |
# set a fancy prompt (non-color, unless we know we "want" color) | |
case "$TERM" in | |
xterm-color) color_prompt=yes;; | |
esac | |
export CLICOLOR=1; | |
# enable color support of ls and also add handy aliases | |
if [ -x /usr/bin/dircolors ]; then | |
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | |
alias ls='ls --color=auto' | |
#alias dir='dir --color=auto' | |
#alias vdir='vdir --color=auto' | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
fi | |
# MARKS ############################################################ | |
# mark and jump | |
# http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-filesystem-from-the-command-line.html | |
export MARKPATH=$HOME/.marks | |
function jump { | |
cd -P $MARKPATH/$1 2>/dev/null || echo "No such mark: $1" | |
} | |
function mark { | |
mkdir -p $MARKPATH; ln -s $(pwd) $MARKPATH/$1 | |
} | |
function unmark { | |
rm -i $MARKPATH/$1 | |
} | |
function marks { | |
\ls -l "$MARKPATH" | tail -n +2 | sed 's/ / /g' | cut -d' ' -f9- | awk -F ' -> ' '{printf "%-10s -> %s\n", $1, $2}' | |
} | |
export PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@Roiz\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ " | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment