blob: d9ee5bee7b27261da7d9e45115d0215372a1bf94 (
plain)
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
|
#!/bin/zsh
# color
alias grep='grep --color=auto'
alias tree='tree -C'
# --sudo $(which doas) --sudoloop --sudoflags'
# common commands
alias less='less -N' # enable line number
alias nvim='VIMINIT="" nvim'
alias v='nvim'
alias gdb='gdb -q' # disable long intro message
alias sudo='sudo ' # enable color (the search for aliases continues)
alias doas='doas ' # same for doas
alias info='info --vi-keys'
# ls
if [ "$(uname)" = 'Linux' ]
then
alias ls='ls --color=auto -Fh'
else
alias ls='ls -G -Fh'
fi
alias ll='ls -l'
alias la='ls -A'
alias lla='ls -Al'
alias lss='ls -Ssh'
# tree
alias tree='tree -FCA'
alias t='tree'
alias ta='tree -a'
alias t1='tree -L 1'
alias t2='tree -L 2'
alias t3='tree -L 3'
alias ti="tree --matchdirs -I __pycache__ -I node_modules -I '*.o' -I build"
# man
alias ma="man"
alias ma1="man 1"
alias ma2="man 2"
alias ma3="man 3"
# make
alias m='make'
alias mre='make re'
alias mclean='make clean'
# git
alias ga='git add'
alias gaa='git add --all'
alias gau='git add --update'
alias gc='git commit'
alias gc!='git commit --amend'
alias gcmsg='git commit --message'
alias gd='git diff'
alias gds='git diff --staged'
alias gdt='git diff --stat'
alias gl='git pull'
alias glg='git log --abbrev-commit --stat'
alias glgg='git log --abbrev-commit --graph'
alias glgo='git log --oneline --no-decorate'
alias gp='git push'
alias gcl='git clone --recurse-submodules'
alias gst='git status'
alias gs='git status'
alias gss='git status --short'
alias gco='git checkout'
alias gsta='git stash push'
alias gstp='git stash pop'
alias grv='git remote -v'
alias gra='git remote add'
alias gb='git branch'
gpa() {
branch="$1"
[ -z "$branch" ] && branch=$(git branch | grep '^\* .*$' | cut -d ' ' -f 2)
git remote | xargs -I{} git push {} "$branch"
}
gpaf() {
branch="$1"
[ -z "$branch" ] && branch=$(git branch | grep '^\* .*$' | cut -d ' ' -f 2)
git remote | xargs -I{} git push -f {} "$branch"
}
alias ytdl='youtube-dl --output "%(title)s.%(ext)s"'
alias ytdlp='youtube-dl --audio-format mp3 -i --output "%(playlist_index)s-%(title)s.%(ext)s"'
alias ytdla='youtube-dl --audio-format mp3 -i -x -f bestaudio/best --output "%(playlist_index)s-%(title)s.%(ext)s"'
# Linux specific aliases
[ ! "$(uname)" = 'Linux' ] && return
alias pacman='pacman --color=auto'
alias valgrindc='colour-valgrind'
alias yay='yay --color=auto'
# lpass (lastpass-cli)
alias lpassp='lpass show --password --clip' # put password in clipboard
# helper to switch between dual and single monitor setup
alias dual='xrandr --output LVDS1 --primary --left-of VGA1 --output VGA1 --mode 1280x1024'
alias single='xrandr --output VGA1 --off'
# parent directory jump
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
# bluetooth
alias bt='bluetoothctl'
alias bton='echo power on | bluetoothctl'
alias btoff='echo power off | bluetoothctl'
alias cagob='RUSTFLAGS="$RUSTFLAGS -A dead_code" cargo build'
alias cagor='RUSTFLAGS="$RUSTFLAGS -A dead_code" cargo run'
# wifi
wificonnect() { nmcli device wifi connect "$1" password "$2" ; }
alias qmvdest='qmv --format=do'
alias xclip='xclip -selection clipboard'
pacman_url() { pacman -Si "$1" | grep URL | tr -s ' ' | cut -d ' ' -f 3 ; }
alias filter-valgrind="sed -e 's/==[0-9]*==/==/' -e 's/0x[0-9A-F]*//'"
rc() {
dir="$HOME/git/dotfiles/"
filepath="$(
find "$dir" -type f -not -path '*.git/*' |
sed "s:$dir::" |
fzf
)" && "$EDITOR" "$dir$filepath"
filename="$(basename "$filepath")"
case "$filename" in
.zshrc|aliases.zsh)
echo 'Reloading zshrc'
# shellcheck source=/dev/null
. "$ZDOTDIR/.zshrc"
;;
zprofile)
echo 'Reloading zprofile'
# shellcheck source=/dev/null
. "$HOME/.zprofile"
;;
xmonad.hs)
echo 'Reloading xmonad'
xmonad --recompile && xmonad --restart
;;
config.py)
echo 'Reloading qutebrowser config'
qutebrowser :config-source
;;
esac
}
vf() { f="$(fzf || exit 1)" && "$EDITOR" "$f" ; }
alias zathura='zathura --fork'
alias xset-reset='xset r rate 200 50'
alias open='xdg-open'
alias csi='rlwrap chicken-csi'
sdcv() {
/usr/bin/sdcv -n --utf8-output --color "$@" 2>&1 |
fold -s -w "$(tput cols)"
}
alias ffmpeg='ffmpeg -hide_banner'
sshvi() {
ssh -t "$1" bash -o vi -i
}
|