Skip to content

Instantly share code, notes, and snippets.

@thomaspuppe
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thomaspuppe/7a7464e2363ad7701302 to your computer and use it in GitHub Desktop.
Save thomaspuppe/7a7464e2363ad7701302 to your computer and use it in GitHub Desktop.
bash config file
# NOTE: This shit is mixed up (Ubuntu Linux vs Mac OS)
# ######################################
# Functions and Parameters for Own Aliases
# ######################################
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
NO_COLOR="\[\033[0m\]"
# ######################################
# Own Aliases
# ######################################
## git shortcuts
alias gs='git status'
alias gpullom='git pull origin master'
alias gpullzonm='git pull zeitonline master'
alias gpushom='git push origin master'
alias gc='git commit'
alias gbranch='git branch -a'
alias glog='git log --graph --decorate --pretty=oneline --abbrev-commit'
## quick ways to get out of current directory
alias cd..='cd ..'
alias ..='cd ..'
alias ..2='cd ../../'
alias ..3='cd ../../../'
alias ..4='cd ../../../../'
alias ..5='cd ../../../../../'
alias ll='ls -alh'
## directory shortcuts
alias cdwww='cd /var/www'
alias cdbt='cd /var/www/bundestwitter.local'
#...
## open file manager on current directory
alias x='nautilus $PWD'
# opens file in textedit (´textedit theFiletoEdit.txt´)
alias textedit='open -a TextEdit'
# opens bash config file in gedit (terminal can be closed without closing gedit)
#alias bashconf='open -a TextEdit ~/.bashrc'
alias bashconf='sublime ~/.bashrc'
# ######################################
# Bash Completion: show current branch in bash
# ######################################
#export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w\[\033[01;33m\]$(__git_ps1)\[\033[01;34m\] \$\[\033[00m\] '
#export PS1="\[${BOLD}${MAGENTA}\]\u\[$WHITE\]@\[$ORANGE\]\h\[$WHITE\]: [\[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" - \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]] \$ \[$RESET\]"
export PS1="$GREEN\u@\h$NO_COLOR:\w$YELLOW\$(parse_git_branch)$NO_COLOR \$ "
# ######################################
# Tools
# ######################################
## sudo the last command
alias fucksudo='sudo $(history -p \!\!)'
## find an excuse
#alias excuse='wget -q -O - programmerexcuses.com | grep "center" | sed "s/<[^>]\+>//g"'
alias excuse='wget -q -O - programmerexcuses.com | grep "center" | sed "s|</b>|-|g" | sed "s|<[^>]*>||g"'
## cmatrix
alias matrix='cmatrix -bs'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment