-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_zshrc.tmpl
252 lines (205 loc) · 5.56 KB
/
dot_zshrc.tmpl
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
# Path to your oh-my-zsh installation.
export ZSH="{{ .chezmoi.homeDir }}/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="cypher"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
DISABLE_UNTRACKED_FILES_DIRTY="true"
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(bgnotify)
{{ if lookPath "git" }}
plugins+=(git)
{{end}}
{{ if lookPath "mvn" }}
plugins+=(mvn)
{{end}}
{{ if lookPath "ansible" }}
plugins+=(ansible)
{{end}}
{{ if lookPath "docker" }}
plugins+=(docker)
{{end}}
{{ if lookPath "docker-compose" }}
plugins+=(docker-compose)
{{end}}
{{ if lookPath "lein" }}
plugins+=(lein)
{{end}}
{{ if lookPath "http" }}
plugins+=(httpie)
{{end}}
{{ if lookPath "man" }}
plugins+=(man)
{{end}}
{{ if lookPath "nmap" }}
plugins+=(nmap)
{{end}}
{{ if lookPath "npm" }}
plugins+=(npm)
{{end}}
{{ if lookPath "yarn" }}
plugins+=(yarn)
{{end}}
{{ if lookPath "pass" }}
plugins+=(pass)
{{end}}
{{ if lookPath "sdk" }}
plugins+=(sdk)
{{end}}
{{ if lookPath "task" }}
plugins+=(taskwarrior)
{{end}}
{{ if lookPath "sudo" }}
plugins+=(sudo)
{{end}}
{{ if lookPath "go" }}
plugins+=(golang)
{{end}}
if [ -d "{{joinPath .chezmoi.homeDir ".asdf"}}" ] ; then
plugins+=(asdf)
fi
source $ZSH/oh-my-zsh.sh
# Setup Aliase
if [ -f "{{joinPath .chezmoi.homeDir ".aliase"}}" ]; then
source "{{joinPath .chezmoi.homeDir ".aliase"}}"
fi
# Setup adfs
if [ -f "$HOME/.adfs/plugins/java/set-java-home.zsh" ] ; then
# Setup JAVA_HOME
. "$HOME/.adfs/plugins/java/set-java-home.zsh"
fi
# export MANPATH="/usr/local/man:$MANPATH"
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='nvim'
# fi
if [[ -c bat ]] ; then
# set bat as manpage reader
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
#
#eval `{{- .home -}}/.dir_colors/dircolors`
# Kubertnetes alias and functions
{{ if lookPath "kubectl" }}
if [[ -c kubectl ]] ; then
. <( kubectl completion zsh ) ;
fi
{{end}}
{{ if lookPath "k8sgpt" }}
if [[ -c k8sgpt ]] ; then
. <( k8sgpt completion zsh ) ;
fi
{{end}}
{{ if lookPath "starship" }}
eval "$(starship init zsh)"
{{end}}
{{ if lookPath "kitty" }}
if [ command -v kitty &> /dev/null ; then
kitty + complete setup zsh | source /dev/stdin
# Workaround for ssh and kitten
if [[ $TERM = "xterm-kitty" ]] ; then
alias ssh="kitty +kitten ssh"
fi
fi
{{end}}
{{ if lookPath "chectl" }}
if [[ -c chectl ]] ; then
. <( chectl autocomplete:script zsh ) ;
fi
{{end}}
{{ if lookPath "rustup" }}
if [[ -c rustup ]] ; then
. <( rustup completions zsh ) ;
fi
{{end}}
{{ if lookPath "flux" }}
if [[ -c flux ]] ; then
. <(flux completion zsh)
fi
{{end}}
{{ if lookPath "terraform" }}
if [[ -c terraform ]] ; then
autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C /usr/bin/terraform terraform
fi
{{end}}
{{ if lookPath "switcher" }}
if [[ -f /usr/local/bin/switch.sh ]] ; then
source /usr/local/bin/switch.sh
fi
{{end}}
{{ if lookPath "kustomize" }}
if [[ -c kustomize ]] ; then
. <(kustomize completion zsh)
fi
{{end}}
{{ if lookPath "istioctl" }}
if [[ -c istioctl ]] ; then
. <(istioctl completion zsh)
fi
{{end}}
{{ if lookPath "pack" }}
if [[ -c pack ]] ; then
. $( pack completion --shell zsh ) ;
fi
{{end}}
{{ if lookPath "restic" }}
if [[ -c restic ]] ; then
source $(restic generate --zsh-completion /dev/stdout)
fi
{{end}}
{{ if lookPath "pfetch" }}
pfetch
{{end}}
{{ if lookPath "direnv" }}
if [[ -c direnv ]] ; then
eval "$(direnv hook zsh)"
fi
{{end}}
{{ if lookPath "zoxide" }}
if [[ -c zoxide ]] ; then
eval "$(zoxide init zsh)"
fi
{{end}}
# asdf go plugin
if [ -d "{{joinPath .chezmoi.homeDir ".asdf/plugins/golang/set-env.zsh"}}" ] ; then
# asdf plugin add golang https://github.com/asdf-community/asdf-golang.git
. ~/.asdf/plugins/golang/set-env.zsh
fi
# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"