This repository has been archived by the owner on Sep 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.zshrc
291 lines (247 loc) · 5.76 KB
/
.zshrc
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
#!/usr/bin/env zsh
##
# Check if TTY if on OpenBSD
##
if [[ "$(uname)" == "OpenBSD" ]]; then
if [[ "$(tty)" == "/dev/ttyC"* ]]; then
export TERM=wsvt25
fi
fi
##
# ENV VARS
##
export PAGER="less"
export LC_CTYPE="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
export EDITOR="emacsclient -nw -c -a ''"
export VISUAL="emacsclient -c -a ''"
##
# export $PATH
##
export PATH=$PATH:/usr/games:$HOME/.cargo/bin:$HOME/.local/bin:$HOME/go/bin
##
# Lazy Loading
##
source ~/.zshrc.d/defer/zsh-defer.plugin.zsh
##
# Autoload zmv
##
zsh-defer autoload -Uz zmv
##
# Setup Completions
##
zsh-defer autoload -U compinit
zsh-defer compinit
zsh-defer autoload -U bashcompinit
zsh-defer bashcompinit
# We don't need to load OpenBSD completions on non-OpenBSD Systems
if [[ "$(uname)" == "OpenBSD" ]]; then
fpath=($HOME/.zshrc.d/openbsd/completions $HOME/.zshrc.d/completions/src $fpath)
else
fpath=($HOME/.zshrc.d/completions/src $fpath)
fi
setopt MENU_COMPLETE
setopt AUTO_LIST
setopt COMPLETE_IN_WORD
zsh-defer eval "$(register-python-argcomplete pipx)"
##
# Java Stuff
##
export PATH=$PATH:/usr/local/jdk-17/bin
export JAVA_HOME=/usr/local/jdk-17/
##
# Elixir/Erlang Stuff
##
export PATH=$PATH:/usr/local/lib/erlang26/bin
##
# Go Stuff
##
export GOPATH=$HOME/.go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
##
# Autopair
##
zsh-defer source ~/.zshrc.d/autopair/autopair.zsh
zsh-defer autopair-init
##
# Suggestions
##
zsh-defer source ~/.zshrc.d/suggest/zsh-autosuggestions.plugin.zsh
##
# Syntax Highlight
##
zsh-defer source ~/.zshrc.d/fsh/fast-syntax-highlighting.plugin.zsh
##
# History substring search
##
zsh-defer source ~/.zshrc.d/substring/zsh-history-substring-search.plugin.zsh
HISTFILE="$HOME/.zshrc.d/.history"
HISTSIZE=10000000
SAVEHIST=10000000
##
# Vim-mode
##
zsh-defer source ~/.zshrc.d/vim-mode/zsh-vim-mode.plugin.zsh
##
# FZF-Zsh
##
if command -v fzf &> /dev/null; then
zsh-defer source ~/.zshrc.d/fzf/fzf-tab.plugin.zsh
zsh-defer source ~/.zshrc.d/fzf-comp/zsh/fzf-zsh-completion.sh
if [[ "$(uname)" == "OpenBSD" ]]; then
export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS' --color=fg:#ebdbb2,bg:#282828,hl:#b16286 --color=fg+:#689d6a,bg+:#32302f,hl+:#d3869b --color=info:#d65d0e,prompt:#458588,pointer:#fe8019 --color=marker:#8ec07c,spinner:#cc241d,header:#fabd2f'
fi
fi
##
# 256-Color
##
zsh-defer source ~/.zshrc.d/256/zsh-256color.plugin.zsh
##
# Ruby Stuff
##
export GEM_HOME="$HOME/.gems"
export PATH=$PATH:$HOME/.gems/bin
##
# Alias for muscle memory
##
if whence -p doas &> /dev/null; then
alias sudo="doas"
alias su="echo 'did you mean to run doas -s? '"
elif whence -p sudo &> /dev/null; then
alias doas="sudo"
alias su="echo 'did you mean to run sudo -i? '"
fi
##
# Alias for CD
##
if command -v zoxide &> /dev/null; then
zsh-defer eval "$(zoxide init --cmd cd zsh)"
fi
##
# Alias for listing files
##
if command -v eza &> /dev/null; then
alias ls="eza --icons=never -Hh"
alias la="eza --icons=never -ah"
alias ll="eza --icons=never -lh"
alias lh="eza --icons=never -lAh"
alias tree="eza --icons=never -Th"
elif command -v colorls &> /dev/null; then
alias ls="colorls -G -Hh"
alias la="colorls -G -ah"
alias ll="colorls -G -lh"
alias lh="colorls -G -lAh"
fi
##
# Alias for parsing
##
if command -v bat &> /dev/null; then
export BAT_THEME=ansi
alias cat="bat -pp"
alias bat="bat -p"
fi
if command -v rg &> /dev/null; then
alias rgrep="rg"
fi
##
# Alias for editing
##
alias edit=$EDITOR
alias vedit=$VISUAL
##
# Alias for media
##
alias audio-dlp="yt-dlp -x --audio-quality 0 --audio-format vorbis \
--concurrent-fragments 5"
alias video-dlp="yt-dlp --write-subs --sub-format srt --remux-video mkv \
--embed-subs --concurrent-fragments 5"
alias tidal-dlp="tidal-dl -o /home/izder456/Music -q Master -r P1080 -l "
##
# Prompt
##
if [[ "$(uname)" == "OpenBSD" ]]; then
PROMPT="%B%F{yellow}%~%f%b%B % %b"
elif [[ "$(uname)" == "FreeBSD" ]]; then
PROMPT="%B%F{red}%~%f%b%B % %b"
else
PROMPT="%B%F{blue}%~%f%b%B % %b"
fi
##
# Bat
##
if command -v bat &> /dev/null; then
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
alias bathelp='bat --plain --language=help'
# Manpager with bat
function man {
command man "$@" | eval ${MANPAGER}
}
# Help Page with bat
function help {
"$@" --help 2>&1 | bathelp
}
fi
##
# Tere config
##
function tere {
local result=$(command tere "$@")
[ -n "$result" ] && cd -- "$result"
}
##
# Binds
##
bindkey "5A" previous-history
bindkey "5B" next-history
bindkey "5C" forward-word
bindkey "5D" backward-word
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
##
# Functions For OpenBSD
##
if [[ "$(uname)" == "OpenBSD" ]]; then
function src {
local _usage
_usage="src [file]"
[ -z $1 ] && echo $_usage
[ ! -z $1 ] &&
cd /usr/src/*/$1 || return
}
function port {
local _usage
_usage="port [port]"
[ -z $1 ] && echo $_usage
[ ! -z $1 ] &&
cd /usr/ports/*/$1 2>/dev/null ||
cd /usr/ports/*/*/$1 2>/dev/null ||
return
}
function pclean {
rm -v **/*.orig **/*(.NL0)
}
function revert_diffs {
zmv -v '**/*.orig' '${f%.orig}'
}
function cdw {
cd $(make show=WRKSRC)
}
function maintains {
local _usage
_usage="maintains [port]"
[ -z $1 ] && echo $_usage
[ ! -z $1 ] &&
(
cd /usr/ports/*/$1 >/dev/null 2>&1 &&
make show=MAINTAINER ||
echo "No port '/usr/ports/*/$1'"
)
}
fi
##
# the r/unixporn rite of passage
##
if command -v crfetch &> /dev/null; then
crfetch
fi
zsh-defer . $HOME/.shellrc.load