-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
170 lines (143 loc) · 4.22 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
# Zsh stuff
zmodload zsh/datetime
setopt extended_glob
setopt GLOB_STAR_SHORT
# helper to only run certain commands if the command is installed
function command-found() {command -v $1 > /dev/null}
function exists() {[ -s "$1" ]}
# _______ ___ __
# / ____/ | / / | / /
# / __/ / |/ /| | / /
# / /___/ /| / | |/ /
# /_____/_/ |_/ |___/
# PATH stuff
export OMZ_HOME=$HOME/.oh-my-zsh
export GCLOUD_HOME="$HOME/.local/google-cloud-sdk"
export GOROOT="$HOME/.local/go"
export PYENV_ROOT="$HOME/.pyenv"
YARN_BIN="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin"
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
export PATH="$HOME/dotfiles/scripts:$HOME/.local/bin:$PYENV_ROOT/bin:$GCLOUD_HOME/bin:$GOROOT/bin:$PATH"
export LANG=en_US.UTF-8
export DOTFILES_HOME="$HOME/dotfiles"
export LESS=XR
# PYTHON ENVS
. "$DOTFILES_HOME/python.env"
# USER stuff and custom local overrides
exists "$HOME/.alias" && . "$HOME/.alias"
exists "$HOME/.path" && . "$HOME/.path"
exists "$HOME/.python.env" && . "$HOME/.python.env"
exists "$HOME/.zshrc.d/zshrc.zsh" && . "$HOME/.zshrc.d/zshrc.zsh"
# EDITOR preference order
if command-found lvim; then
export EDITOR='lvim'
elif command-found nvim; then
export EDITOR='nvim'
elif command-found vim; then
export EDITOR='vim'
else
export EDITOR='nano'
fi
###### BEGIN OH-MY-ZSH ######
ZSH_THEME="agnoster" # set to null so we can use starship
COMPLETION_WAITING_DOTS="true"
# History
HIST_STAMPS="yyyy-mm-dd"
HISTSIZE=50000
SAVEHIST=100000
# OH-MY-ZSH
plugins=(
battery
bgnotify
command-not-found
copybuffer
docker
emoji
extract
fast-syntax-highlighting
fd
fzf
gh
git
gitignore
httpie
isodate
kubectx
kubetail
microk8s
nmap
pip
poetry
ssh-agent
terraform
ubuntu
ufw
wakeonlan
z
zsh-autosuggestions
zsh-completions
zsh-interactive-cd
)
CUSTOM_OMZ_FILE="$HOME/.zshrc.d/omz-additional.zsh" # e.g. for adding plugins
if exists "$CUSTOM_OMZ_FILE"; then
. $CUSTOM_OMZ_FILE
fi
source "$OMZ_HOME/oh-my-zsh.sh"
# plugin settings
notify_threshold=120 # for bgnotify min seconds
FAST_HIGHLIGHT[use_brackets]=1 # brackets work correctly
###### END OH-MY-ZSH ######
### fzf
exists "$HOME/.fzf.zsh" && . "$HOME/.fzf.zsh"
### pyenv
export PYENV_VIRTUALENV_MANAGE=true
command-found pyenv && eval "$(pyenv init -)"
### cargo
exists "$HOME/.cargo/env" && . "$HOME/.cargo/env"
### nvm
NVM_DIR="$HOME/.nvm"
exists "$NVM_DIR/nvm.sh" && . "$NVM_DIR/nvm.sh" # This loads nvm
# my stuff
exists "$DOTFILES_HOME/utd.sh" && . "$DOTFILES_HOME/utd.sh"
exists "$DOTFILES_HOME/functions.sh" && . "$DOTFILES_HOME/functions.sh"
command-found thefuck && eval $(thefuck --alias) && eval $(thefuck --alias oops)
# X env only
alias clipboard='xclip -sel clip'
# Wezterm only
alias imgcat='wezterm imgcat'
alias pdr='patch-deployment-image reader'
# copilot
command-found github-copilot-cli && eval "$(github-copilot-cli alias -- "$0")"
############ THEME ##############
# ides + starship do not mix well
if ! [[ $TERMINAL_EMULATOR = 'JetBrains'* || $TERM_PROGRAM = 'vscode'* ]]
then
eval "$(starship init zsh)"
fi
################################
### Misc completions ###
command-found kubectl && . <(kubectl completion zsh)
command-found helm && . <(helm completion zsh)
command-found skaffold && . <(skaffold completion zsh)
command-found pipx && eval "$(register-python-argcomplete pipx)"
command-found ruff && . <(ruff generate-shell-completion zsh)
command-found minikube && . <(minikube completion zsh)
command-found gcloud && . "$GCLOUD_HOME/completion.zsh.inc"
command-found poe && . <(poe _zsh_completion)
command-found stern && . <(stern --completion zsh)
command-found istioctl && . <(istioctl completion zsh)
command-found kn && . <(kn completion zsh)
command-found argocd && . <(argocd completion zsh)
command-found yq && . <(yq completion zsh)
exists "$NVM_DIR/bash_completion" && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# below is needed to activate completions correctly
compinit
alias gactivate="gcloud config configurations activate"
# pnpm
export PNPM_HOME="/home/adam/.local/share/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# pnpm end
[[ -s "/home/adam/.gvm/scripts/gvm" ]] && source "/home/adam/.gvm/scripts/gvm"