-
Notifications
You must be signed in to change notification settings - Fork 67
/
.zshrc
232 lines (140 loc) · 4.39 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
# ~~~~~~~~~~~~~~~ SSH ~~~~~~~~~~~~~~~~~~~~~~~~
# Using GPG + YubiKey for ssh.
# Don't execute when in dev container
if [[ -z "$REMOTE_CONTAINERS" && -z "$CODESPACES" && -z "$DEVCONTAINER_TYPE" ]]; then
export GPG_TTY="$(tty)"
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
gpgconf --launch gpg-agent
gpg-connect-agent updatestartuptty /bye > /dev/null 2>&1
fi
# ~~~~~~~~~~~~~~~ Environment Variables ~~~~~~~~~~~~~~~~~~~~~~~~
# Set to superior editing mode
set -o vi
export VISUAL=nvim
export EDITOR=nvim
export TERM="tmux-256color"
export BROWSER="firefox"
# Directories
export REPOS="$HOME/Repos"
export GITUSER="mischavandenburg"
export GHREPOS="$REPOS/github.com/$GITUSER"
export DOTFILES="$GHREPOS/dotfiles"
export LAB="$GHREPOS/lab"
export SCRIPTS="$DOTFILES/scripts"
export ICLOUD="$HOME/icloud"
export ZETTELKASTEN="$HOME/Zettelkasten"
# Go related. In general all executables and scripts go in .local/bin
export GOBIN="$HOME/.local/bin"
export GOPRIVATE="github.com/$GITUSER/*,gitlab.com/$GITUSER/*"
# export GOPATH="$HOME/.local/share/go"
export GOPATH="$HOME/go/"
# ~~~~~~~~~~~~~~~ Path configuration ~~~~~~~~~~~~~~~~~~~~~~~~
setopt extended_glob null_glob
path=(
$path # Keep existing PATH entries
$HOME/bin
$HOME/.local/bin
$HOME/dotnet
$SCRIPTS
$HOME/.krew/bin
$HOME/.rd/bin # Rancher Desktop
/home/vscode/.local/bin # Dev Container Specifics
/root/.local/bin # Dev Container Specifics
)
# Remove duplicate entries and non-existent directories
typeset -U path
path=($^path(N-/))
export PATH
# ~~~~~~~~~~~~~~~ Dev Container Specifics ~~~~~~~~~~~~~~~~~~~~~~~~
if [ -d "/home/linuxbrew/.linuxbrew" ]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
# ~~~~~~~~~~~~~~~ History ~~~~~~~~~~~~~~~~~~~~~~~~
HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=100000
setopt HIST_IGNORE_SPACE # Don't save when prefixed with space
setopt HIST_IGNORE_DUPS # Don't save duplicate lines
setopt SHARE_HISTORY # Share history between sessions
# ~~~~~~~~~~~~~~~ Prompt ~~~~~~~~~~~~~~~~~~~~~~~~
PURE_GIT_PULL=0
if [[ "$OSTYPE" == darwin* ]]; then
fpath+=("$(brew --prefix)/share/zsh/site-functions")
else
fpath+=($HOME/.zsh/pure)
fi
autoload -U promptinit; promptinit
prompt pure
# ~~~~~~~~~~~~~~~ Aliases ~~~~~~~~~~~~~~~~~~~~~~~~
alias v=nvim
alias scripts='cd $SCRIPTS'
alias cdblog="cd ~/websites/blog"
alias c="clear"
alias icloud="cd \$ICLOUD"
# Repos
alias lab='cd $LAB'
alias dot='cd $GHREPOS/dotfiles'
alias repos='cd $REPOS'
alias ghrepos='cd $GHREPOS'
alias gr='ghrepos'
alias cdgo='cd $GHREPOS/go/'
alias rob='cd $REPOS/github.com/rwxrob'
# Homelab
alias homelab='cd $GHREPOS/homelab/'
alias hl='homelab'
alias hlp='cd $GHREPOS/homelab-private/'
alias hlps='cd $GHREPOS/homelab-private-staging/'
alias hlpp='cd $GHREPOS/homelab-private-production/'
alias skool='cd $GHREPOS/skool/'
# ls
alias ls='ls --color=auto'
alias la='ls -lathr'
# alias la='exa -laghm@ --all --icons --git --color=always'
# finds all files recursively and sorts by last modification, ignore hidden files
alias lastmod='find . -type f -not -path "*/\.*" -exec ls -lrt {} +'
alias t='tmux'
alias e='exit'
alias syu='sudo pacman -Syu'
# Azure
alias sub='az account set -s'
# Git
alias gp='git pull'
alias gs='git status'
alias lg='lazygit'
# Zettelkasten
alias in="cd \$ZETTELKASTEN/0\ Inbox/"
alias cdzk="cd \$ZETTELKASTEN"
# Kubernetes
alias k='kubectl'
alias kgp='kubectl get pods'
alias kc='kubectx'
alias kn='kubens'
alias fgk='flux get kustomizations'
# Pass
alias pc='pass show -c'
# Devpod
alias ds='devpod ssh'
# Bluetooth
# Airpods Max
alias btm='bluetoothctl connect 08:FF:44:0E:EA:D6'
# Airpods
alias bta='bluetoothctl connect 08:65:18:78:BD:A6'
# ~~~~~~~~~~~~~~~ Completion ~~~~~~~~~~~~~~~~~~~~~~~~
fpath+=~/.zfunc
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh-completions:$FPATH
fi
autoload -Uz compinit
compinit -u
zstyle ':completion:*' menu select
# Example to install completion:
# talosctl completion zsh > ~/.zfunc/_talosctl
# ~~~~~~~~~~~~~~~ Sourcing ~~~~~~~~~~~~~~~~~~~~~~~~
source "$HOME/.privaterc"
source <(fzf --zsh)
eval "$(direnv hook zsh)"
# ~~~~~~~~~~~~~~~ Misc ~~~~~~~~~~~~~~~~~~~~~~~~
fpath+=~/.zfunc; autoload -Uz compinit; compinit