-
Notifications
You must be signed in to change notification settings - Fork 1
/
zshrc
198 lines (150 loc) · 4.77 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
# Ensure brew can be found
# Issue seen on m1 max mbp
[[ -f /opt/homebrew/bin/brew ]] && eval $(/opt/homebrew/bin/brew shellenv)
# Check for ARM or Intel arch
[[ $(uname -m) == "arm64" ]] && export IS_ARM=true || export IS_ARM=false
# Setup TTY for GPG
export GPG_TTY=$(tty)
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/kevin/.oh-my-zsh"
export USE_GKE_GCLOUD_AUTH_PLUGIN=True
# Add wisely, as too many plugins slow down shell startup.
plugins=(
fzf
git
zsh-completions
zsh-autosuggestions
)
# node repl
# - this WARNS
# alias repl="NODE_PATH=$(npm root -g) node"
# - use this instead
alias repl="NODE_PATH=$(npm root --location=global) node"
alias dm="dark-mode"
# Fix this error:
# complete:13: command not found: compdef
autoload -Uz compinit
compinit
# 1password
eval "$(op completion zsh)"; compdef _op op
# OpenAI
. "$HOME/.openai/credentials"
# ensure brew is in path
export PATH=/opt/homebrew/bin:$PATH
# deno
export PATH="$HOME/.deno/bin:$PATH"
# go-bindata
export PATH=$PATH:$(go env GOPATH)/bin
# GOPATH
export GOPATH=$(go env GOPATH)
export AWS_PAGER=""
# Note this needs to come after plugins=(...)
# in order for plugins to load.
source $ZSH/oh-my-zsh.sh
# Starship Prompt
export STARSHIP_CONFIG="$HOME/starship.toml"
eval "$(starship init zsh)"
# FZF
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# Sounds...
# # Turn off all beeps
# unsetopt BEEP
# Turn off autocomplete beeps
unsetopt LIST_BEEP
# Added by Amplify CLI binary installer
export PATH="$HOME/.amplify/bin:$PATH"
# The next line updates PATH for Netlify's Git Credential Helper.
if [ -f '/Users/kevin/.netlify/helper/path.zsh.inc' ]; then source '/Users/kevin/.netlify/helper/path.zsh.inc'; fi
# Terraform
autoload -U +X bashcompinit && bashcompinit
alias tf=terraform
# TAB COMPLETIONS
## Terraform
complete -o nospace -C /opt/homebrew/bin/terraform terraform
## Nomad
complete -o nospace -C /opt/homebrew/bin/nomad nomad
# fnm
eval "$(fnm env --use-on-cd)"
# Python
# alias python=/usr/local/bin/python3
alias python=/opt/homebrew/bin/python3
alias pip=/opt/homebrew/bin/pip3
alias ls=/opt/homebrew/bin/exa
# Ruby
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# By default, binaries installed by gem will be placed into:
# /opt/homebrew/lib/ruby/gems/3.1.0/bin
export PATH="/opt/homebrew/lib/ruby/gems/3.1.0/bin:$PATH"
#
# You may want to add this to your PATH.
#
# ruby is keg-only, which means it was not symlinked into /opt/homebrew,
# because macOS already provides this software and installing another version in
# parallel can cause all kinds of trouble.
#
# If you need to have ruby first in your PATH, run:
export PATH="/opt/homebrew/opt/ruby/bin:$PATH"
#
# For compilers to find ruby you may need to set:
# export LDFLAGS="-L/opt/homebrew/opt/ruby/lib"
# export CPPFLAGS="-I/opt/homebrew/opt/ruby/include"
#
# For pkg-config to find ruby you may need to set:
# export PKG_CONFIG_PATH="/opt/homebrew/opt/ruby/lib/pkgconfig"
# Android
export ANDROID_SDK=/Users/kevin/Library/Android/sdk
# function
function aws_config() {
aws_config_clear
echo "============"
echo " AWS Config "
echo "============"
access_key_id_label="Access key ID"
secret_access_key_label="Secret access key"
eval $(op signin)
AWS_ACCESS_KEY_ID=$(op item get "AWS" --fields label=$access_key_id_label)
AWS_SECRET_ACCESS_KEY=$(op item get "AWS" --fields label=$secret_access_key_label)
if [ -e ~/.aws/credentials ]; then
rm ~/.aws/credentials
fi
eval $(export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID)
eval $(export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY)
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
echo "✅"
}
function aws_config_clear() {
echo "=================="
echo " AWS Config Clear "
echo "=================="
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
unset AWS_SESSION_TOKEN
unset AWS_SESSION_EXPIRATION
}
function get_ghcr_token() {
# check 1password signin status
EXIT_CODE=0
op account get > /dev/null 2>&1 || EXIT_CODE=$?
if [ $EXIT_CODE -gt 0 ]; then
eval $(op signin)
fi
echo $(op item get "github" --format=json --fields label=CR_PAT | jq -r ".value")
}
function get_gh_token() {
# check 1password signin status
EXIT_CODE=0
op account get > /dev/null 2>&1 || EXIT_CODE=$?
if [ $EXIT_CODE -gt 0 ]; then
eval $(op signin)
fi
echo $(op item get "github" --format=json --fields label=PAT | jq -r ".value")
}
# bun completions
[ -s "/Users/kevin/.bun/_bun" ] && source "/Users/kevin/.bun/_bun"
# bun
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
source /Users/kevin/.config/op/plugins.sh