-
Notifications
You must be signed in to change notification settings - Fork 3
/
.common_shrc
129 lines (103 loc) · 3.09 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# vi: ft=sh
if command -v /opt/homebrew/bin/brew &> /dev/null; then
eval "$(/opt/homebrew/bin/brew shellenv)"
if test -d "$(brew --prefix)/opt/coreutils/libexec/gnubin"; then
export PATH="$(brew --prefix)/opt/coreutils/libexec/gnubin:$PATH"
fi
# proper awk needed for diff2vimgrep
if test -d "$(brew --prefix)/opt/gawk/libexec/gnubin"; then
export PATH="$(brew --prefix)/opt/gawk/libexec/gnubin:$PATH"
fi
fi
if command -v pyenv &> /dev/null; then
# eval "$(pyenv init -)"
fi
# 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 nvim &> /dev/null; then
export EDITOR="nvim"
else
export EDITOR="vim"
fi
# 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
}
# find snippet
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 be="bundle exec"
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 "
if command -v direnv &> /dev/null; then
alias tmux='direnv exec / tmux'
fi
alias ll='ls -l'
alias la='ls -la'
# remove duplicate lines that match a pattern (preserves order)
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 hub &> /dev/null; then
eval "$(hub alias -s)"
alias git=hub
fi
alias fl=fleetctl
alias dc=docker-compose
alias dm=docker-machine
alias ts="tmux list-sessions | sed -s 's/:.*//' | fzf | xargs tmux switch -t"
alias hs=httpstat
alias uuid="uuidgen | tr -d '\n' | tr '[:upper:]' '[:lower:]'"
if command -v bat &> /dev/null; then
alias cat=bat
fi
if command -v htop &> /dev/null; then
alias top=htop
fi
if command -v ncdu &> /dev/null; then
alias du="ncdu --color dark -rr -x --exclude .git --exclude node_modules"
fi
if command -v xdg-open &> /dev/null; then
alias open=xdg-open
fi
alias dokku='$HOME/.dokku/contrib/dokku_client.sh'
alias ks=kubectl
export PATH="$PATH:$HOME/flutter/bin"
alias rg='rg --hidden'
# export NVM_LAZY_LOAD=true
# export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm