Skip to content

Instantly share code, notes, and snippets.

@kurtbartholomew
Last active August 29, 2015 14:08
Show Gist options
  • Save kurtbartholomew/d99f94685e5780f7ef1c to your computer and use it in GitHub Desktop.
Save kurtbartholomew/d99f94685e5780f7ef1c to your computer and use it in GitHub Desktop.
# Add RVM to PATH for scripting
export PATH="$PATH:$HOME/.rvm/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# user-defined aliases
alias rm='rm -vi'
alias cp='cp -vi'
alias mv='mv -vi'
alias clean='rm -f "#"* "."*~ *~ *.bak *.dvi *.aux *.log'
alias svim='sudo vim'
alias checktouchpad='xinput list'
alias turnofftouchpad='xinput set-prop $ "Device Enabled" 0'
# Prevent history duplication
export HISTCONTROL=ignoredups
# cd aliases
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
# cd into the old directory
alias bd='cd "$OLDPWD"'
# Grab current git branch for prompt
function find_git_branch {
local dir=. head
until [ "$dir" -ef / ]; do
if [ -f "$dir/.git/HEAD" ]; then
head=$(< "$dir/.git/HEAD")
if [[ $head == ref:\ refs/heads/* ]]; then
git_branch=" (${head#*/*/})"
elif [[ $head != '' ]]; then
git_branch=' (detached)'
else
git_branch=' (unknown)'
fi
return
fi
dir="../$dir"
done
git_branch=''
}
# Initialize $git_branch data for prompt
PROMPT_COMMAND="find_git_branch; $PROMPT_COMMAND"
# Set prompt
export PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[01;34m\] \w\[\033[01;32m\]\$git_branch\[\033[01;34m\]\n\$ \[\033[00m\]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment