Last active
August 29, 2015 13:58
-
-
Save cosmith/9970506 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
################################################################################################### | |
# Prompt | |
################################################################################################### | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
black='\['`tput sgr0; tput setaf 0`'\]' | |
red='\['`tput sgr0; tput setaf 1`'\]' | |
green='\['`tput sgr0; tput setaf 2`'\]' | |
yellow='\['`tput sgr0; tput setaf 3`'\]' | |
blue='\['`tput sgr0; tput setaf 4`'\]' | |
magenta='\['`tput sgr0; tput setaf 5`'\]' | |
cyan='\['`tput sgr0; tput setaf 6`'\]' | |
white='\['`tput sgr0; tput setaf 7`'\]' | |
nocolor='\e[0m' | |
# Print all my local IP addresses (IPv4) separated by a space | |
function myip { | |
/sbin/ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | |
} | |
export PS1="\n$green\$(myip) $blue\w $red\$(parse_git_branch)$nocolor:\n" | |
################################################################################################### | |
# Aliases | |
################################################################################################### | |
# 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 grep='grep --color=auto' | |
fi | |
# some more ls aliases | |
alias ll='ls -l' | |
alias la='ls -A' | |
alias l='ls -CF' | |
# enable programmable completion features (you don't need to enable | |
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile | |
# sources /etc/bash.bashrc). | |
if ! shopt -oq posix; then | |
if [ -f /usr/share/bash-completion/bash_completion ]; then | |
. /usr/share/bash-completion/bash_completion | |
elif [ -f /etc/bash_completion ]; then | |
. /etc/bash_completion | |
fi | |
fi | |
export PATH=$PATH:$HOME/bin | |
function lint | |
{ | |
flake8 --ignore=E501 --exclude=migrations,media,settings,tests.py --max-complexity 10 $1 | |
} | |
# enable git autocompletion | |
source ~/.git-completion.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment