-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.shell_aliases
333 lines (293 loc) · 8.73 KB
/
.shell_aliases
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# vim: ft=sh
alias title="printf '\033]0;%s\007'"
alias T="Terminal"
alias e="ef"
alias c="cf"
alias rp="rsync -ahvz --progress;b"
alias rv="rsync -ahvz --progress --remove-source-files;b"
if [[ "$OSTYPE" =~ "darwin" ]]; then
#alias iina="open -a iina"
#alias spotify="open -a spotify"
alias slack="open -a slack"
alias safari="open -a safari"
alias xcode="open -a xcode"
#alias dash="open -a dash"
alias notes="open -a notes"
alias wavebox="open -a wavebox"
alias eclipse="open -a eclipse"
alias processing="open -a processing"
alias keycastr="open -a keycastr"
alias filezilla="open -a filezilla"
alias wireshark="open -a wireshark"
alias vlc='/Applications/VLC.app/Contents/MacOS/VLC'
alias harvest="open -a harvest"
alias haskell="open -a haskell"
alias handbrake="open -a handbrake"
alias hyper="open -a hyper"
alias activity="open -a activity\ monitor"
alias chrome="open -a google\ chrome"
alias k="open -a Keychain\ Access"
#alias htop="sudo htop"
alias xcr="xcodebuild -project xcode/*.xcodeproj 2>/dev/null | xcpretty --no-utf --color"
alias xcd="xcodebuild -project xcode/*.xcodeproj 2>/dev/null -configuration Debug | xcpretty --no-utf --color"
alias xc=xcd
fi
alias oo="o"
alias d="fasd_cd -d"
alias lsdf="ls -d \.*"
alias ssh="env TERM=screen-256color ssh"
#alias ranger="ranger-cd"
alias ra="ranger-cd"
alias ip3="ipython3"
alias ip="ip3"
alias pti="ptipython"
alias bp2="python2 -m bpython.cli"
alias bp3="python3 -m bpython.cli"
alias bp="bp3"
alias p2="python2"
alias p3="python3"
alias p="p3"
alias v="vim"
alias vv="vim -u NONE"
alias view="$EDITOR -R"
alias vs="code"
alias v.="v ."
alias vd="v -d"
alias F="v '+F'"
alias S="v '+S'"
alias MB="v '+MB'"
alias RG="v +RGG"
alias vtop="vtop --theme brew"
alias goto=". goto"
alias su="sudo su"
alias pg="ping google.com"
alias pgh="ping https://www.github.com"
alias ipscan="arp -a | sed 's/ at.*$//' | sed 's/\.gateway//' | sed 's/[\(\)]//g' | grep -v '^\?' | column -t"
alias m="make"
alias mc="make clean"
alias :q="exit"
alias t="tree -L2 *"
alias cp="cp -i"
alias mv="mv -i"
alias rm="rm -v"
alias gdb="gdb -q"
alias gdp="gdb -p"
alias yt="youtube-dl"
alias ym="youtube-dl --ignore-config -f 'bestaudio' --extract-audio --audio-format=mp3 --embed-thumbnail"
alias y="yt"
alias yi="y --ignore-config"
alias bell="tput bel"
alias b="bell"
alias fb="fg;b"
alias bu="brew update && brew upgrade && brew cleanup;b"
alias j="jobs"
alias sb="git sb"
alias ss="git status -s"
alias a="git_add"
alias ga="git_add"
alias gc="git_commit"
alias gca="git commit --amend"
alias gcv="git_commit -v"
alias grs="git_reset"
alias grv="git remote -v"
alias gmm="git merge master"
alias com="git checkout \$(git branch -rl '*/HEAD' | grep -o '[^/]*$')"
alias comm="com"
alias cob="git checkout -b"
alias gcd='cd "`git rev-parse --show-toplevel 2>/dev/null | head -1`"'
alias cdg="gcd"
alias gd="git diff"
alias gd.="git diff ."
alias gdc="git diff --cached"
alias gdc.="git diff --cached ."
alias gdh="git diff HEAD"
alias gdh.="git diff HEAD ."
alias gdd="git difftool"
alias gdv="nvim +Gina\ diff\|set\ nonu\ nornu"
alias gdm="gd master"
alias gg="git grep -i -n --heading --break"
alias lg="git lg"
alias lgs="git lg --stat"
alias lgh="git lg -n10"
alias lgh.="lgh ."
alias lgl="lg origin/master..HEAD"
#alias clo="git clone --recursive -j4 && cd *(/om[1])" # moved to .zsh_functions
alias gsm="git submodule update --init --recursive"
alias gdmb="gd master...HEAD"
alias gddmb="gdd master...HEAD"
alias lgmb="lg master...HEAD"
alias gdmbf='gdmb `gdmb --name-only | fzf -m --preview "git diff --color=always master...HEAD {}"`'
alias gddmbf='gddmb `gdmb --name-only | fzf -m --preview "git diff --color=always master...HEAD {}"`'
alias co="git_checkout"
alias cof="ba | grep -v master | fzf --preview='{ git diff --color=always --stat master...{}; git diff --color=always master...{}; } | ~/git/git-split-diffs/bin/git-split-diffs --color' | xargs git checkout"
alias ba="git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)'"
alias baa="git branch -a"
alias push="git push"
alias pu="git push -u"
alias puf="git push -u -f"
alias pull="git pull"
alias stash="git stash -k"
alias pop="git stash pop 2>&1 >/dev/null && s"
alias show="git show"
alias sp="stash && pull && stash pop"
alias sl="git sl"
alias rl="git rl"
alias skgg="sk -i -c 'git grep -i -n --color=always \"{}\"'"
alias gu="gitup"
alias nvm="fnm"
#alias br="browse" #conflict
alias ni="n install"
alias nt="n test"
alias ntw="n test --watch"
alias ne="n test:e2e-ui"
alias ni="n test:isolated-ui"
alias nb="n build"
alias na="n add"
alias nu="n uninstall"
alias snatch="zou"
alias translate="trans"
alias dict="trans -d"
alias powershell="pwsh"
alias ncdu="ncdu --color dark"
alias cdp='cd `fd "package." | xargs -n 1 dirname | grep '/' | fzf || echo .`'
if [ ! $BASH ]; then
# if using with hub:
# https://github.com/robbyrussell/oh-my-zsh/issues/1727#issuecomment-22366771
# brew uninstall --force git && brew install git --without-completions
# as of September 2018, formula needs to be pinned.
# https://stackoverflow.com/a/17757092
compdef _git s=git-status
compdef _git a=git-add
compdef _git ga=git-add
compdef _git gc=git-commit
compdef _git gcv=git-commit
compdef _git grs=git-reset
compdef _git grv=git-remote
compdef _git gd=git-diff
compdef _git gdc=git-diff
compdef _git gdh=git-diff
compdef _git stash=git-stash
compdef _git co=git-checkout
compdef _git lg=git-log
compdef _git ba=git-branch
compdef _git push=git-push
compdef _git pull=git-pull
compdef _git show=git-show
compdef _git clo=git-clone
compdef _yarn n=yarn
fi
alias show_desktop_icons="defaults write com.apple.finder CreateDesktop true; killall Finder"
alias hide_desktop_icons="defaults write com.apple.finder CreateDesktop false; killall Finder"
alias rg="rg -S \
--colors 'path:fg:green' \
--colors 'path:style:nobold' \
--colors 'line:fg:yellow' \
--colors 'line:style:nobold' \
--colors 'match:fg:black' \
--colors 'match:bg:yellow' \
--colors 'match:style:nobold'"
# \
# -g '!Library/' \
# -g '!Downloads/' \
# -g '!Pictures/' \
# -g '!Music/'"
alias skag="sk -i -c 'ag --color \"{}\"'"
alias skg="sk -i -c 'rg --glob=!tags --line-number --color=always \"{}\" -S \
--colors 'path:fg:green' \
--colors 'path:style:nobold' \
--colors 'line:fg:yellow' \
--colors 'line:style:nobold' \
--colors 'match:fg:black' \
--colors 'match:bg:yellow' \
--colors 'match:style:nobold''"
if [ "$(basename $SHELL)" = "zsh" ]; then
alias cd.="nocorrect cd ."
alias cd..="nocorrect cd .."
alias cd...="nocorrect cd ../.."
alias cd....="nocorrect cd ../../.."
alias cd.....="nocorrect cd ../../../.."
alias mv="nocorrect mv -iv"
alias cp="nocorrect cp -iv"
alias mkdir="nocorrect mkdir -pv"
alias git="nocorrect git"
alias npm="nocorrect npm"
if command -v nvim >/dev/null 2>&1; then
alias vim="nvim"
fi
else
alias cd.="cd ."
alias cd..="cd .."
alias cd...="cd ..."
alias cd....="cd ...."
alias cd.....="cd ....."
alias mv="mv -iv"
alias cp="cp -iv"
alias mkdir="mkdir -pv"
fi
if command -v sn >/dev/null 2>&1; then
alias ds="sn sort -n 10 | head -9 | sed 's/\.\///'"
else
alias ds="du -ah * | egrep -v '^\s*\d+K' | sort -nr | head"
fi
function ls_wrapper() {
local bin
local args=()
if [[ ! "$@" =~ "-[A-Za-z]*l" ]]; then
args+=-x
fi
if command -v exa >/dev/null 2>&1; then
bin=exa
args+=(--icons --group-directories-first)
elif [[ "$OSTYPE" =~ "darwin" ]]; then
bin=ls
args+=-G
else
bin=ls
args+=(--group-directories-first --color=auto)
fi
# test for if in interactive shell
if [[ -t 0 || -p /dev/stdin ]]; then
$bin "${args[@]}" $@
fi
}
function ct() {
export DISABLE_AUTO_TITLE=true && tmux rename-window " $1"
}
function cleanpipe() {
# usage: cleanpipe tcp:9999
lsof -i "$1"
lsof -t -i "$1" | xargs kill
}
alias ls=ls_wrapper
if command -v exa >/dev/null 2>&1; then
alias tree="exa --tree --icons"
else
alias tree="tree -C"
fi
if command -v git-st >/dev/null 2>&1; then
alias s='(set -o pipefail && git-st 2>/dev/null | perl -pe "s/^((?:(?>(?:\e\[.*?m)*).){$COLUMNS}).*/\$1\e[m/") || ls'
alias s.='(set -o pipefail && git-st . 2>/dev/null | perl -pe "s/^((?:(?>(?:\e\[.*?m)*).){$COLUMNS}).*/\$1\e[m/") || ls'
else
alias s="git sb 2>/dev/null || ls"
fi
if command -v gcal >/dev/null 2>&1; then
alias cal="gcal"
fi
if command -v hub >/dev/null 2>&1; then
alias git="hub"
fi
if ! command -v fd >/dev/null 2>&1; then
alias fd="find . -iname"
fi
if command -v xclip >/dev/null 2>&1; then
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
fi
if [[ "$TERM" == "xterm-kitty" ]]; then
alias ssh="kitty +kitten ssh"
fi
if command -v browsh >/dev/null 2>&1; then
alias browse="browsh --startup-url"
elif command -v w3m >/dev/null 2>&1; then
alias browse="w3m"
fi