2016-05-06 17:04:10 +01:00
# If not running interactively, don't do anything
case $- in
*i*) ; ;
*) return ; ;
esac
# don't put duplicate lines or lines starting with space in the history.
HISTCONTROL = ignoreboth
# 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
[ -x /usr/bin/lesspipe ] && eval " $( SHELL = /bin/sh lesspipe) "
# set variable identifying the chroot you work in (debian-based only)
if [ -z " ${ debian_chroot :- } " ] && [ -r /etc/debian_chroot ] ; then
debian_chroot = $( cat /etc/debian_chroot)
fi
# Set prompt
2016-07-07 17:38:01 +01:00
PS1 = '${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
2016-05-06 17:04:10 +01:00
# If this is an xterm set the title to user@host:dir
case " $TERM " in
xterm*| rxvt*)
PS1 = " \[\e]0; ${ debian_chroot : +( $debian_chroot ) } \u@\h: \w\a\] $PS1 "
; ;
*)
; ;
esac
# enable color support
if [ -x /usr/bin/dircolors ] ; then
test -r ~/.dircolors && eval " $( dircolors -b ~/.dircolors) " || eval " $( dircolors -b) "
alias ls = 'ls --color=auto'
2016-07-07 17:38:01 +01:00
alias dir = 'dir --color=auto'
alias vdir = 'vdir --color=auto'
2016-05-06 17:04:10 +01:00
alias grep = 'grep --color=auto'
alias fgrep = 'fgrep --color=auto'
alias egrep = 'egrep --color=auto'
fi
# colored GCC warnings and errors
export GCC_COLORS = 'error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases
alias ll = 'ls -alF'
alias la = 'ls -A'
alias l = 'ls -CF'
# Add an "alert" alias for long running commands
alias alert = 'notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e ' \' 's/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//' \' ')"'
2016-07-07 17:38:01 +01:00
# 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).
2016-05-06 17:04:10 +01:00
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
2016-07-07 17:38:01 +01:00
# Load Programs
2016-05-06 17:04:10 +01:00
export NVM_DIR = "/home/jake/.nvm"
[ -s " $NVM_DIR /nvm.sh " ] && . " $NVM_DIR /nvm.sh " # Load on ubuntu
eval $( thefuck --alias)
2016-07-07 17:38:01 +01:00
2016-05-06 17:04:10 +01:00
# Export some variables
export ANDROID_HOME = /opt/android-sdk
2016-07-07 17:38:01 +01:00
# Extend PATH
export PATH = ${ PATH } :${ ANDROID_HOME } /tools
export PATH = ${ PATH } :${ ANDROID_HOME } /platform-tools
2016-05-06 17:04:10 +01:00
export PATH = ${ PATH } :/opt/genymobile/genymotion
2016-07-07 17:38:01 +01:00
export PATH = ~/.bin:${ PATH }
2016-05-06 17:04:10 +01:00
2016-07-07 17:38:01 +01:00
# Export Java home on ubuntu
if [ -f " $( command -v lsb_release) " ] ; then
2016-05-06 17:04:10 +01:00
JAVA_HOME = /usr/local/java/jdk1.8.0_73
2016-07-07 17:38:01 +01:00
export PATH = ${ PATH } :$JAVA_HOME /bin
2016-05-06 17:04:10 +01:00
fi
2016-07-07 17:38:01 +01:00
# npm aliases
2016-05-06 17:04:10 +01:00
alias ni = "npm install"
alias ns = "npm start"
alias nt = "npm test"
nb( ) {
if [ $# -eq 0 ] ; then
command npm run build
else
for arg in " $@ "
do
command npm run build-${ arg }
done
fi
}
nr( ) {
for arg in " $@ "
do
command npm run $arg
done
}
2016-07-07 17:38:01 +01:00
alias nrc = "npm run coverage"
alias nrm = "npm run mocha"
alias nvmu = "nvm use"
# React extras
2016-05-06 17:04:10 +01:00
export REACT_EDITOR = atom
alias rnl = "adb logcat | grep ReactNative"
2016-07-07 17:38:01 +01:00
2016-05-06 17:04:10 +01:00
# catfish aliases
ctp( ) {
if [ [ $1 = = "shell" ] ] ; then
command ctf project run manage.py shell
elif [ [ $1 = = "build" ] ] ; then
command ctf project run build
elif [ $1 = = "test" ] || [ $1 = = "t" ] ; then
command ctf project run runtests ${ @ : 2 }
elif [ [ $1 = = "migrate" ] ] ; then
command ctf project run manage.py migrate
2016-07-07 17:38:01 +01:00
elif [ [ $1 = = "makemigrations" ] ] ; then
command ctf project run manage.py makemigrations
2016-05-06 17:04:10 +01:00
else
command ctf project $@
fi
}
alias ctfs = "cd ~/catfish && ./start && cd - > /dev/null"
2016-07-07 17:38:01 +01:00
2016-05-06 17:04:10 +01:00
# bash aliases
alias src = "source ~/.bashrc"
2016-07-07 17:38:01 +01:00
alias refresh = " cd $PWD > /dev/null "
alias c = "clear"
export EDITOR = /bin/nano
2016-05-06 17:04:10 +01:00
# git aliases
alias gs = "git status"
alias gd = "git diff"
2016-07-07 17:38:01 +01:00
gh( ) {
command git clone git@github.com:${ 1 } /${ 2 } # My bash isnt great...
}
# Gnome
gd-lock( ) {
sessionid = ` /bin/loginctl list-sessions | grep jake | awk '{print $1}' `
/bin/loginctl lock-session $sessionid
}
gd-unlock( ) {
sessionid = ` /bin/loginctl list-sessions | grep jake | awk '{print $1}' `
/bin/loginctl unlock-session $sessionid
}
alias gdl = "gd-lock"
alias gdu = "gd-unlock"
2016-05-06 17:04:10 +01:00
# miscellaneous software aliases
alias y = "yoga"
alias ym = "yoga mode"
alias serve = "python -m SimpleHTTPServer"