Skip to content

Instantly share code, notes, and snippets.

@Kein1945
Last active January 11, 2017 11:37
Show Gist options
  • Save Kein1945/9914022 to your computer and use it in GitHub Desktop.
Save Kein1945/9914022 to your computer and use it in GitHub Desktop.
Bashrc with great fucking advice prompt, git branch, xterm title
ssh_mount_dir='servers/'
export TERM=xterm-256color
export EDITOR="vim"
export CDPATH=:..:~/$ssh_mount_dir:~
if [[ $- != *i* ]] ; then
return
fi
# Enable history appending instead of overwriting.
shopt -s histappend
alias ls='ls --color -h'
alias ll='ls -laGt'
alias l='ls -CF'
alias grep='grep --color=always'
alias grp='grep -n'
alias less='less -r'
alias df='df -k --print-type --human-readable'
alias du='du -k --total --human-readable'
alias ls='ls --color=auto'
alias ll='ls --group-directories-first -l --human-readable'
alias lr='ls --recursive'
alias la='ll --almost-all'
alias lx='ll -X --ignore-backups'
alias lz='ll -S --reverse'
alias lt='ll -t --reverse'
alias lm='la | more'
alias http='python2 -m SimpleHTTPServer'
alias ocat=/usr/bin/cat
alias cat=lolcat
alias cal=cal --color=always
parse_git_branch () {
pwd | /usr/bin/grep $ssh_mount_dir &>/dev/null && df -h | /usr/bin/grep $(pwd | /usr/bin/grep $ssh_mount_dir.*[^/]) | awk '{print $1}' 2> /dev/null || echo $(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (branch:\1)/')
}
parse_git_tag () {
git describe --tags 2> /dev/null
}
parse_git_branch_or_tag() {
local OUT="$(parse_git_branch)"
if [ "$OUT" == " ((no branch))" ]; then
OUT="(tag:$(parse_git_tag))";
fi
echo $OUT
}
PS1='\[\033]0;\u:${PWD##*/}\007\]\[\e[0;32m\]\u\[\e[m\]\[\e[0;32m\]@\h\[\e[m\] \[\e[0;36m\][\t]\[\e[m\] \[\e[0;32m\]$(parse_git_branch_or_tag)\[\e[m\]\n\[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] \[\e[1;37m\]'
#less colors
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment