summaryrefslogtreecommitdiffstats
path: root/.config/zsh/alias.zsh
blob: 57e88c353f81184d106959bc5020aa84444b203d (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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# alias.zsh
# ========================
# =====    ===============
# ======  ================
# ======  ================
# ======  ====   ====   ==
# ======  ===     ==  =  =
# ======  ===  =  ==     =
# =  ===  ===  =  ==  ====
# =  ===  ===  =  ==  =  =
# ==     =====   ====   ==
# ========================

alias exa='exa --color=always --group-directories-first --icons' \
	ls='exa -l'
tree() {
	exa -T $@ | less
}
alias \
	e='editorcmd' \
	vim='nvim' \
	c='clear' \
	less='less --tabs 4' \
	bc='bc -l' \
	mkf='gmake fclean' \
	mkc='gmake clean' \
	mk='gmake -j9' \
	bmkc='make clean' \
	bmk='make -j9' \
	web='w3m https://duckduckgo.com/' \
	mpv='mpv --audio-channels=stereo' \
	bat='bat --style=plain --tabs 4 --paging=always -f' \
	cp='cp -iv' \
	mv='mv -iv' \
	rm='rm -v' \
	ln='ln -v' \
	df='df -h' \
	du='du -h' \
	mkdir='mkdir -v' \
	rmdir='rmdir -v' \
	chmod='chmod -v' \
	chown='chown -v' \
	mount='mount -v' \
	rsync='rsync -v -h' \
	grep='grep --color=always' \
	rgrep='grep -R -n -H' \
	fsl='fossil' \
	diff='colordiff' \
	ctags='uctags "--exclude=.ccls*"' \
	yt='pipe-viewer -f' \
	yta='pipe-viewer -n' \
	gyt='gtk-pipe-viewer' \
	ytdl='yt-dlp --add-metadata' \
	ytdlist='yt-dlp -F' \
	ytdl1080="yt-dlp --add-metadata -f '[height<=1080]'" \
	irssi='irssi --config="$XDG_CONFIG_HOME"/irssi/config --home="$XDG_DATA_HOME"/irssi' \
	irc='irssi' \
	free='freecolor' \
	gt='gpg-tui' \
	dgit='git --git-dir=$HOME/docs/dotfiles-bsd --work-tree=$HOME' \
	confgit='git --git-dir=$HOME/docs/conffiles-bsd --work-tree=/' \
	gjdo='/usr/home/jozan/dev/perl/gitjoe-scripts/gitjoe-do.pl'
upsrc() {
	doas git -C /usr/src pull --ff-only
}
upports() {
	doas pkg update &&
		doas git -C /usr/ports pull --ff-only &&
		doas portmaster -a
}
alias realupdate='doas portmaster -dya --no-confirm'
alias \
	gst='git status' \
	ga='git add' \
	gco='git commit -m' \
	gpp='git push' \
	gpo='git push origin' \
	gl="git log --graph --format=format:'%C(yellow)%h %C(bold blue)%ah %C(bold green)(%ar)%C(bold yellow)%d%C(reset) %s %C(dim white)- %an <%ae>%C(reset)' --all" \
	dgl="dgit log --graph --format=format:'%C(yellow)%h %C(bold blue)%ah %C(bold green)(%ar)%C(bold yellow)%d%C(reset) %s %C(dim white)- %an <%ae>%C(reset)' --all" \
	dgst="dgit status"
gg() {
	git add .
	git commit -m "$*" || return 1
	git push
}
dgg() {
	dgit add -u
	dgit commit -m "$*" || return 1
	dgit push
}
alias \
	srcnt='find . -type f -name "*.c" -exec cat {} \; | sed "/^\//d" | sed "/^\*/d" | sed "/^ \*/d" | sed "/^\/\//d" | sed "/^$/d" | wc -l | tr -d " "' \
	v='nvim $(fzf --preview="head -$FZF_PREVIEW_LINES {}")' \
	tohex='printf "0x%x\n"'
ebin() {
	p=$(pwd)
	cd "$HOME"/.local/bin || return
	sc=$(fzf --preview='head -$FZF_PREVIEW_LINES {}')
	if [ ! "$sc" ]; then
		cd $p
		return
	fi
	${VISUAL} $sc
	cd $p
}
econf() {
	p=$(pwd)
	cd "$HOME"/.config || return
	sc=$(fzf --preview='head -$FZF_PREVIEW_LINES {}')
	if [ ! "$sc" ]; then
		cd $p
		return
	fi
	$VISUAL $sc
	cd $p
}
eebin() {
	file=$(find "$HOME"/.local/bin -type f | fzf)
	[ $? -ne 0 ] && return
	bsdsetsid emacsclient -c "$file"
	kill -9 "$(ps -p $$ -oppid=)"
}
eeconf() {
	file=$(find "$HOME"/.config -type f | fzf)
	[ $? -ne 0 ] && return
	bsdsetsid emacsclient -c "$file"
	kill -9 "$(ps -p $$ -oppid=)"
}
ee() {
	file=$(find . -type f | fzf)
	[ $? -ne 0 ] && return
	bsdsetsid emacsclient -c "$file"
	kill -9 "$(ps -p $$ -oppid=)"
}
pa() {
	if [ -d $HOME/.local/packs ] && cd $HOME/.local/packs || return 1
	dir=$(\ls $HOME/.local/packs | fzf)
	[ -z $dir ] && return || cd $dir
}
co() {
	if [ "$1" ]; then
		if cd "$XDG_CONFIG_HOME"/"$1"; then
			:
		else
			cd "$XDG_CONFIG_HOME"
		fi
	else
		cd "$XDG_CONFIG_HOME"
	fi
}
da() {
	if [ "$1" ]; then
		if cd "$XDG_DATA_HOME"/"$1"; then
			:
		else
			cd "$XDG_DATA_HOME"
		fi
	else
		cd "$XDG_DATA_HOME"
	fi
}
alias bi='cd $HOME/.local/bin' \
	  sss='cd $HOME/docs/work/secuserve/scripts'
twi() {
	mpview https://twitch.tv/"$1";
}
alias nb='newsboat' \
	mutt='neomutt' \
	sxiv='nsxiv -b -a' \
	pinfo='pkg info -x' \
	psearch='pkg search' \
	pinstall='doas pkg install' \
	update='doas pkg update && doas pkg upgrade' \
	highlight='highlight -Oxterm256 -t4' \
	hi='highlight'
hil() {
	highlight -Oxterm256 -t4 "$1" | less
}
search() {
	make -C /usr/ports search name=$1 | grep 'Path:';
}
alias watch='cmdwatch' \
	tsd='transmission-daemon' \
	tsm='transmission-remote' \
	rsox='sox -t oss default' \
	pstree='dtpstree -U' \
	open='xdg-open' \
	speedtest='speedtest --bytes' \
	calcurse='calcurse -C $XDG_CONFIG_HOME/calcurse -D $XDG_DATA_HOME/calcurse' \
	abook='abook -C $XDG_CONFIG_HOME/abook/abookrc --datafile $XDG_DATA_HOME/abook/addressbook' \
	dosbox='dosbox -conf $XDG_CONFIG_HOME/dosbox/dosbox.conf' \
	gpg='gpg2' \
	mysql='mycli -u root -h' \
	wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'