forked from artemave/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.common_shrc
104 lines (86 loc) · 2.6 KB
/
.common_shrc
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# enable color support of ls and also add handy aliases
if command -v dircolors &> /dev/null; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
elif [[ `uname` == 'Darwin' ]]; then
alias ls='ls -GF'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
if command -v reattach-to-user-namespace &> /dev/null; then
alias vim="reattach-to-user-namespace vim"
alias pbcopy="reattach-to-user-namespace pbcopy"
alias ios-sim="reattach-to-user-namespace ios-sim"
alias appium="reattach-to-user-namespace appium"
fi
export EDITOR="vim"
# batch rename. ex: `mmv **/*2008.mp3 **/*2009.mp3`
if command -v zmv &> /dev/null; then
alias mmv='noglob zmv -W'
fi
parsegitbranch() {
git branch &>/dev/null;
if [ $? -eq 0 ]; then
echo " ($(git branch 2> /dev/null | grep '^*' |sed s/\*\ //))";
fi
}
function take() {
mkdir $1
cd $1
}
if [ -d ~/.ec2 ]; then
export JAVA_HOME="$(/usr/libexec/java_home)"
export EC2_PRIVATE_KEY="$(/bin/ls "$HOME"/.ec2/pk-*.pem | /usr/bin/head -1)"
export EC2_CERT="$(/bin/ls "$HOME"/.ec2/cert-*.pem | /usr/bin/head -1)"
export EC2_HOME="/usr/local/Library/LinkedKegs/ec2-api-tools/jars"
fi
# find snippet
function fsnip() {
egrep -C1 -R $1 "$HOME/.vim/bundle/vim-snippets/snippets/"
}
# less colors (for man)
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;34m'
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'
alias man='man -P less'
alias ccat="pygmentize -g"
alias be="bundle exec"
alias bec="bundle exec cucumber"
alias ber="bundle exec rspec"
alias g="git "
alias gs="g status"
alias gp="g push "
alias gd="g diff -w "
alias gdc="gd --cached"
alias gc="g commit -a "
alias tmux="tmux -2"
alias ll='ls -l'
alias la='ls -la'
# remove duplicate lines that match a pattern (preserves order)
function rmdups() {
awk '{if ($0 ~ /'$0'/) { if (!a[$2]++) { print $0 } } else { print $0 }}' $1
}
alias gocode="cd ~/projects/gocode/src/github.com/artemave"
if command -v rbenv &> /dev/null; then
eval "$(rbenv init -)"
fi
if command -v hub &> /dev/null; then
eval "$(hub alias -s)"
alias git=hub
fi
# added by travis gem
[ -f ~/.travis/travis.sh ] && source ~/.travis/travis.sh
alias fucking=sudo
alias fl=fleetctl
alias dc=docker-compose
alias ts="tmux list-sessions | sed -s 's/:.*//' | fzf | xargs tmux switch -t"