-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_zshrc
149 lines (117 loc) · 4.64 KB
/
dot_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
# ~/.zshrc
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
COMPLETION_WAITING_DOTS="true"
HIST_STAMPS="yyyy-mm-dd"
plugins=(
aliases
dotenv
git
brew
kubecolor
kubectl-context-lock
alias-tips
encode64
vscode
fzf
quick-look
completions
company
)
# -------------------------------------------------------------------
# zstyle config
# -------------------------------------------------------------------
zstyle ':omz:update' mode disabled
# -------------------------------------------------------------------
# Aliases
# -------------------------------------------------------------------
alias gitstatusall="find $HOME/Documents -maxdepth 4 -mindepth 1 -type d -name ".git" -exec sh -c 'cd {}/.. && pwd && git status --short --branch && echo' \;"
alias gitpullall="find $HOME/Documents -maxdepth 4 -mindepth 1 -type d -name ".git" -exec sh -c 'cd {}/.. && pwd && git pull 2> /dev/null && echo' \;"
alias zshconfig="vsc ~/.zshrc"
alias ohmyzsh="vsc ~/.oh-my-zsh"
alias update="~/.config/scripts/update.sh"
alias moi=chezmoi
alias moicd="cd $(chezmoi source-path)"
alias kx="kubectx"
alias kn="kubens"
alias cil="cilium"
alias watch="KUBECOLOR_FORCE_COLORS=true watch --color "
alias rcat="$(which cat)"
alias cat="$(which bat)"
# -------------------------------------------------------------------
# Variables
# -------------------------------------------------------------------
export EDITOR="vim"
export VSCODE="codium"
export KUBE_EDITOR="codium --wait"
export ZSH_PLUGINS_ALIAS_TIPS_EXCLUDES="_ kubectl"
export STARSHIP_CONFIG=~/.config/starship/starship.toml
export KUBECOLOR_CONFIG=~/.config/kubecolor/color.yaml
export K9S_CONFIG_DIR=~/.config/k9s
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export DFT_BYTE_LIMIT="2000000"
# -------------------------------------------------------------------
# PATH
# -------------------------------------------------------------------
# https://formulae.brew.sh/formula/coreutils
# PATH="$(brew --prefix)/opt/coreutils/libexec/gnubin:$PATH"
# https://formulae.brew.sh/formula/gnu-sed
# PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH"
# https://docs.brew.sh/Shell-Completion
fpath+="$(brew --prefix)/share/zsh/site-functions"
# https://formulae.brew.sh/formula/zsh-completions
# fpath+="$(brew --prefix)/share/zsh-completions"
# https://github.com/zsh-users/zsh-completions/issues/1083
fpath+="${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src"
# https://krew.sigs.k8s.io/docs/user-guide/setup/install/
path+="${KREW_ROOT:-$HOME/.krew}/bin"
# https://blog.luispa.dev/posts/how-to-install-go-using-zsh
path+="${GOPATH:-$HOME/go}/bin"
# -------------------------------------------------------------------
# Custom functions
# -------------------------------------------------------------------
# Certificate validation
certval() {
crtID=$(openssl x509 -noout -modulus -in $1 | openssl md5)
keyID=$(openssl rsa -noout -modulus -in $2 | openssl md5)
if [ "$crtID" = "$keyID" ]; then
echo "Match!"
true
else
echo "No match!"
false
fi
}
# SSH autocompletion really slow fix
host_list=($(grep "Host " ~/.ssh/config 2>/dev/null | awk '{s = s $2 " "} END {print s}'))
host_list+=($(grep "Host " ~/.ssh/config-bedag 2>/dev/null | awk '{print $2 " " $3}'))
zstyle ':completion:*:(ssh|scp|sftp):*' hosts $host_list
# iTerm random tab color
function tabcolor {
echo -n -e "\033]6;1;bg;red;brightness;$(jot -r 1 0 255)\a"
echo -n -e "\033]6;1;bg;green;brightness;$(jot -r 1 0 255)\a"
echo -n -e "\033]6;1;bg;blue;brightness;$(jot -r 1 0 255)\a"
}
# -------------------------------------------------------------------
# Initialize Starship
# -------------------------------------------------------------------
eval "$(starship init zsh)"
# -------------------------------------------------------------------
# Initialize Oh My Zsh
# -------------------------------------------------------------------
source "$(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
source "$(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
source "$ZSH/oh-my-zsh.sh"
# -------------------------------------------------------------------
# Initialize Atuin
# -------------------------------------------------------------------
eval "$(atuin init zsh)"
unset HISTFILE
# -------------------------------------------------------------------
# Initialize Zoxide
# -------------------------------------------------------------------
eval "$(zoxide init zsh --cmd cd)"
# -------------------------------------------------------------------
# Initialize Key Bindings
# -------------------------------------------------------------------
bindkey '^ ' autosuggest-accept