-
Notifications
You must be signed in to change notification settings - Fork 2
/
bashrc_extra
73 lines (63 loc) · 2.11 KB
/
bashrc_extra
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# command prompt shows git branch
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_COLOUR="\[\033[0m\]"
PS1="$GREEN\u@\h$NO_COLOUR:\w$YELLOW\$(parse_git_branch)$NO_COLOUR\$ "
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
export PATH="$HOME/bin:$PATH"
fi
if [ -d "$HOME/.local/bin" ] ; then
export PATH="$HOME/.local/bin:$PATH"
fi
# Add Krew path to bin if exists
if [ -d "${KREW_ROOT:-$HOME/.krew}/bin" ] ; then
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
fi
# Add Cargo path to bin if exists
if [ -d "$HOME/.cargo/bin" ] ; then
export PATH="$HOME/.cargo/bin:$PATH"
fi
# store the ssh auth sock in the home folder for access from tmux
if [ ! -z "$SSH_AUTH_SOCK" -a "$SSH_AUTH_SOCK" != "$HOME/.ssh/agent_sock" ] ; then
unlink "$HOME/.ssh/agent_sock" 2>/dev/null
ln -s "$SSH_AUTH_SOCK" "$HOME/.ssh/agent_sock"
export SSH_AUTH_SOCK="$HOME/.ssh/agent_sock"
fi
# aliases for tmux
export TMUXTMP=~/.tmuxtmp
mkdir -p $TMUXTMP
alias newmoo="TMPDIR=$TMUXTMP tmux new -s moo"
alias moo="TMPDIR=$TMUXTMP tmux attach -dt moo"
alias fixmoo='TMPDIR=$TMUXTMP killall -s SIGUSR1 tmux'
alias vimdiff='vim -d'
alias ck='git checkout'
alias cm='git commit -am "progress $(TZ=America/Los_Angeles date)"'
alias gp='git cherry-pick'
alias gl='git log'
alias st='git status && git diff --stat'
alias pl='git pull'
alias ph='git push --force-with-lease'
alias mg='git fetch && git merge origin/master --no-edit'
alias fh='git fetch'
alias gd='git diff origin/master...'
alias ch='git cherry-pick'
alias submit='git status && git diff --stat && git commit -am progress && git push'
alias br='git log --graph --oneline --decorate --all'
alias src='source ~/.bashrc'
alias rc='cd ~/code/rc'
alias activate='source venv/bin/activate'
# enable bash completion
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
# enable git autocompletion
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# disable scroll lock
stty -ixon