/
aliases.sh
100 lines (83 loc) · 2.56 KB
/
aliases.sh
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
echo "setting aliases"
# - Shortcuts
alias simpleserver='python2.7 -m SimpleHTTPServer 8000'
alias sublo='subl .'
alias atomo='atom .'
alias towero='gittower .'
alias venv='source ./venv/bin/activate'
# - Cool upgrade commands
alias brewup='brew update; brew upgrade;'
alias npmup='npm install -g npm@latest; npm update -g;'
alias yarnup='yarn global upgrade;'
alias pipup="pip3 install --upgrade pip; pip3 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs pip3 install -U;"
alias pip2up="pip2 install --upgrade pip; pip2 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs pip2 install -U;"
alias gemup='gem update'
# - Python alias
alias python='python3'
alias pip='pip3'
# - zsh
alias refresh='source ~/.zshrc'
alias l='ls -a -1 -X --file-type --color --human-readable'
alias lsl='ls -a -l --human-readable'
alias v='nvim'
alias howdeep='echo $SHLVL'
# /shrug might not work? shells are weird
isgitdir() {
command -v git && git rev-parse --show-toplevel 2>/dev/null
}
# - Ctags
makectags() {
CTAGS_CMD='ctags -f .tags -L-'
if [[ $(command -v fd) ]]; then
fd -H -E '.git' | eval $CTAGS_CMD
elif [[ $(command -v git) && $(git rev-parse --show-toplevel 2>/dev/null) ]]; then
git ls-files | eval $CTAGS_CMD
elif [[ $(command -v rg) ]]; then
rg --hidden --files | eval $CTAGS_CMD
else
find . | eval $CTAGS_CMD
fi
}
howbig() {
ls -lh $1
}
space_seq() { seq $1 $2 | tr '\n' ' ' | head -c -1 }
# find the commit which merged $2 into $1
find_merge_for() {
git log $2..$1 --ancestry-path --merges --reverse
}
# see the diff which branch $2 makes from branch $1 (like the github "compare" view)
gcompare () {
if [ ! "$#" -eq 2 ]; then echo "Need two branches to compare!"; return 1; fi
git diff $(git merge-base $1 $2)..$2
}
# - Cargo
alias cgoc='cargo clean'
alias cgob='cargo build'
alias cgor='cargo run'
# - Git
# alias gb='GIT_PAGER=cat git branch'
alias gs='git status'
alias gcn='git commit -n'
alias gits='git status'
alias gitd='git diff'
alias gdc='git diff --cached'
alias gita='git add'
alias gitaa='git add --all'
alias gitc='git commit'
alias gitca='git commit --all'
alias gmc="git merge --continue"
alias gitf='git fetch'
alias gitfr='git fetch; git rebase'
alias gitpl='git pull'
alias gitpr='git pull --rebase'
alias gitpo='git push origin'
alias gsl='git stash list'
alias gf='git fetch --no-tags'
alias gr='git restore'
alias glgg='git log --graph --full-history --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s"'
unalias gsd
# - k8s
alias k='kubectl'
# - General Sweetness
alias weather='curl wttr.in'