-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zsh_aliases
107 lines (91 loc) · 3.29 KB
/
.zsh_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
# shellcheck shell=bash
# Environment
# History management is provided by $(brew --prefix fz)/shell/key-bindings.zsh
alias ..='cd ..'
alias cdc='cd ~/Documents'
alias cdd='cd ~/Downloads'
alias cde='cd ~/Desktop'
alias cdo='cd ~/OneDrive'
alias esl='exec $SHELL -l'
alias l='ls -lA'
alias microsoft-auto-update='open /Library/Application\ Support/Microsoft/MAU2.0/Microsoft\ AutoUpdate.app'
alias mau=microsoft-auto-update
alias vlc='open -a VLC'
#alias yt-dlp-720="yt-dlp -f 'best[height<=720]'"
alias yt-dlp-720="yt-dlp -S 'height:720'"
alias yt-dlp-best-video-all-audio="yt-dlp -f 'bv*+mergeall[vcodec=none]' --audio-multistreams"
alias yt-dlp-smallest-res="yt-dlp -S '+res'"
jd() {
cd "$(johnny-decimal.sh $1)"
}
# Git
alias homegit='GIT_DIR=$HOME/.homegit/ GIT_WORK_TREE=$HOME git'
alias g=git
alias gbc='git checkout -b'
alias gbm='git branch --move'
alias gCm='git commit --message'
alias gCanoe='git commit --amend --no-edit'
alias gcm='git checkout $(git-branch-master)'
alias giA='git add --all'
alias gpb='git push --set-upstream origin "$(git-branch-current 2> /dev/null)"'
alias gr='git rebase'
alias gra='git rebase --abort'
alias grc='git rebase --continue'
alias gri='git rebase --interactive'
alias gsiu='git submodules update --init'
alias gwd='git diff'
alias gwdc='git diff --cached'
alias gwR='git reset --hard'
alias gwr='git reset --soft'
alias gws='git status --short --ignore-submodules=all'
alias t=tig
git() {
if [[ $PWD = "$HOME" ]]; then
GIT_DIR=$HOME/.homegit/ GIT_WORK_TREE=$HOME command git "$@"
else
command git "$@"
fi
}
gbD() {
if [[ $1 ]]; then
git branch --delete --force "$1"
else
#git branch --sort=-committerdate --no-color | egrep -v 'master$' | egrep -v '^\* ' | fzf +m | sed 's/* //' | xargs -r git branch --delete
#git branch --merged | fzf +m | sed "s/.* //" | xargs -r git branch --delete
git branch --sort=-committerdate | grep -E -v '^\* ' | fzf -m | xargs -r command git branch --delete --force
fi
}
gco() {
if [[ $1 == -a || $1 == --all ]]; then
# There's no need to delete "remotes/" and keep the following "origin/": given a branch name, git will fetch it if not locally available.
git branch --all --no-color | sed 's/.* //' | sed 's#remotes/##' | sed 's#origin/##' | sort | uniq | fzf -0 -1 | xargs -r git checkout
elif [[ $@ ]]; then
git checkout "$@"
else
# Alternative version based on https://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit
git branch --sort=-committerdate --no-color | fzf -0 -1 | xargs -r git checkout
fi
}
ga() {
for f in "$@"; do
git add "$f"
[[ -f $f || -d $f ]] && git commit --message "Add $(basename "$f")" -- "$f"
done
}
gu() {
for f in "$@"; do
[[ -f $f || -d $f ]] && git commit --message "Update $(basename "$f")" -- "$f"
done
}
# Heroku
alias hrpm='heroku run python manage.py'
# Python
alias svba='source venv/bin/activate'
# Java
alias mvncc='mvn clean spotless:apply test-compile'
alias mvncv='mvn clean spotless:apply verify'
alias mvncvst='mvn clean spotless:apply verify -DskipTests'
alias mvnep='mvn help:effective-pom'
alias mvnx='mvn clean spotless:apply spring-boot:run'
alias spotless='mvn --quiet spotless:apply'
alias sp=spotless