-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot-zsh_aliases
131 lines (114 loc) · 3.81 KB
/
dot-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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/zsh
# Config bare repo management
alias dtf='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
# Generic
alias zshrc='$EDITOR ~/.zshrc'
alias r!='source ~/.zshrc'
alias zmv='noglob zmv -W'
alias watch='watch '
alias ssh='TERM=xterm-color ssh'
alias ic='invenio-cli'
alias sed='gsed'
alias htop='TERM=xterm htop'
alias vd='TERM=xterm vd'
alias ungron='gron -u'
# Editors
alias c.='code .'
alias code='code '
alias v.='nvim .'
alias vim='nvim'
alias z.='zed .'
# Find
alias fd='find . -type d -iname'
alias ff='find . -type f -iname'
# pip
alias p='noglob pip'
alias pi='pip install'
alias pu='pip uninstall'
alias pia='noglob pip install .[all]'
alias pie='noglob pip install -e'
alias piea='noglob pip install -e .[all]'
alias pf='pip list | grep -i '
# uv pip equivalents, could possibly become the default
alias upf='uv pip list | grep -i '
alias up='noglob uv pip'
alias upi='uv pip install'
alias upu='uv pip uninstall'
alias upia='noglob uv pip install .[all]'
alias upie='noglob uv pip install -e'
alias upiea='noglob uv pip install -e .[all]'
alias upf='uv pip list | grep -i '
# Git
alias gs='git status'
alias gsh='git show --ext-diff'
alias gstash='git stash save --include-untracked'
alias gc='git commit -S'
alias gca='git commit --amend -S'
alias gcad='git commit --amend -S --date=now'
alias gr='git remote -v'
alias gru='git remote update'
alias glu='git pull upstream'
alias gd='git diff -w'
alias gdc='git diff -w --cached'
alias gbd='f() { git branch -D $1 }; f'
gbdr () {
git branch -D "$1" && git push origin :"$1"
}
compdef __git_branch_names gbdr
alias gt='f() { git tag -a $1 -m "release: $1" }; f'
GIT_LOG_FORMAT="\
%C(auto,yellow)%h%C(auto)%d \
%C(auto,reset)%s \
[%C(auto,blue)%<(6,trunc)%an%x08%x08%C(auto,reset), \
%C(auto,cyan)%ar%C(auto,reset)]"
alias gl='noglob git log -25 --all --graph --pretty=format:$GIT_LOG_FORMAT'
alias gdel='f() { git branch -D $1 && git push ${2:-origin} :$1; }; f'
alias gsync='f() { git checkout master && git pull ${1:-upstream} master; }; f'
alias gdog='\
mkdir -p ~/tmp && \
rsync -a --delete `pwd` ~/tmp/ && \
cowsay -f `ls /usr/share/cowsay/cows | shuf -n 1` "You have my permission to git now..."'
alias ggmail='git config user.email [email protected]'
alias gcern='git config user.email [email protected]'
# Docker
alias dl="docker ps -l -q"
alias dps="docker ps"
alias dpa="docker ps -a"
alias di="docker images"
# Docker-compose
alias dcup='docker-compose up'
alias dcb='docker-compose build'
alias dcrm='docker-compose rm'
alias dcps='docker-compose ps'
alias dcstop='docker-compose stop'
alias dcrestart='docker-compose restart'
# OpenShift
alias oc="TERM=xterm-color oc"
# Virtualenv
alias v='workon'
alias v.mk='f() { mkvirtualenv -p python3 ${1:-$(basename $(pwd))}}; f'
alias v.mk2='f() { mkvirtualenv -p python2 ${1:-$(basename $(pwd))}}; f'
alias v.mk39='f() { mkvirtualenv -p python3.9 ${1:-$(basename $(pwd))}}; f'
alias v.mk310='f() { mkvirtualenv -p python3.10 ${1:-$(basename $(pwd))}}; f'
alias v.mk311='f() { mkvirtualenv -p python3.11 ${1:-$(basename $(pwd))}}; f'
alias v.mk312='f() { mkvirtualenv -p python3.12 ${1:-$(basename $(pwd))}}; f'
alias v.rm='rmvirtualenv'
alias v.cd='cdvirtualenv'
alias v.sp='cdsitepackages'
alias v.set='setprojectdir'
alias v.add2virtualenv='add2virtualenv'
alias v.lssitepackages='lssitepackages'
# Invenio-specific
alias v.i='cdvirtualenv var/instance'
# Other CLI apps
alias http='noglob http'
alias pg='f() { c=${1:-$(basename $(pwd))}; pgcli "postgresql://$c:$c@localhost:5432/$c"; }; f'
# WebM to GIF
function webm2gif() {
ffmpeg -y -i $1 -vf palettegen _tmp_palette.png
ffmpeg -y -i $1 -i _tmp_palette.png -filter_complex paletteuse -r 10 ${1%.webm}.gif
rm _tmp_palette.png
}
## FZF
# Select a line from a file and copy to clipboard
alias fzf_cc='f() { cat $1 | fzf --multi --tac --no-sort | clipcopy }; f'