-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_zshrc.tmpl
121 lines (101 loc) · 3.82 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
# Homebrew setup
if [ -d "/opt/homebrew" ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
elif [ -d "~/.linuxbrew" ]; then
eval "$(~/.linuxbrew/bin/brew shellenv)"
elif [ -d "/home/linuxbrew" ]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
# initialize vars used by plugins
# in ~/.zshrc, before Oh My Zsh is sourced:
export ZSH_DOTENV_ALLOWED_LIST=~/.cache/dotenv-allowed.list
export ZSH_DOTENV_DISALLOWED_LIST=~/.cache/dotenv-disallowed.list
export ZSH_CACHE_DIR=~/.cache
export AUTOSWITCH_DEFAULT_PYTHON=python3
# Source antidote
echo "Source antidote"
source $(brew --prefix)/share/antidote/antidote.zsh
# initialize plugins statically with ${ZDOTDIR:-~}/.zsh_plugins.txt
source ~/.zsh_plugins.zsh
setopt promptsubst
# Setup up shell
echo "Set up shell extras"
# Additional alias not in completions
# Git
alias gdours="git diff REBASE_HEAD~ HEAD"
alias gdthiers="git diff REBASE_HEAD~ REBASE_HEAD"
{{ if has "garmin" .tags -}}
export VAULT_FORMAT=json
alias vaultola='export VAULT_ADDR=https://vault-ola.garmin.com;echo \"Logging into $VAULT_ADDR as $USER ...\";vault login -method=ldap username=$USER'
alias vaultkcg='export VAULT_ADDR=https://vault-kcg.garmin.com;echo \"Logging into $VAULT_ADDR as $USER ...\";vault login -method=ldap username=$USER'
alias vaultcn1='export VAULT_ADDR=https://vault-cn1.garmin.com;echo \"Logging into $VAULT_ADDR as $USER ...\";vault login -method=ldap username=$USER'
alias vaultukb='export VAULT_ADDR=https://vault-ukb.garmin.com;echo \"Logging into $VAULT_ADDR as $USER ...\";vault login -method=ldap username=$USER'
{{ end }}
echo "Set up functions"
# curl with time output
curltime() {
curl -so /dev/null -w "\
namelookup: %{time_namelookup}s\n\
connect: %{time_connect}s\n\
appconnect: %{time_appconnect}s\n\
pretransfer: %{time_pretransfer}s\n\
redirect: %{time_redirect}s\n\
starttransfer: %{time_starttransfer}s\n\
-------------------------\n\
total: %{time_total}s\n" "$@"
}
# Rsync destination first
if command -v rsync > /dev/null ; then
function mcp {
DEST=$1
shift
rsync -avz --progress $@ $DEST
}
fi
if command -v kubectl > /dev/null; then
function krun() {
cmd="kubectl run -i --tty $(uuidgen) --rm --image=busybox:1.28 --restart=Never -- /bin/sh -c \"$1\""
echo "$cmd"
eval $cmd
}
fi
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
echo "Set up KUBECONFIG"
# Set the default kube context if present
DEFAULT_KUBE_CONTEXTS="$HOME/.kube/config"
if test -f "${DEFAULT_KUBE_CONTEXTS}"
then
export KUBECONFIG="$DEFAULT_KUBE_CONTEXTS"
fi
# Additional contexts should be in ~/.kube/custom-contexts/
CUSTOM_KUBE_CONTEXTS="$HOME/.kube/custom-contexts"
mkdir -p "${CUSTOM_KUBE_CONTEXTS}"
OIFS="$IFS"
IFS=$'\n'
if [ -z "$KUBECONFIG" ]; then
export KUBECONFIG=~/.kube/config
fi
for contextFile in `find "${CUSTOM_KUBE_CONTEXTS}" -type f -name "*.yml"`
do
export KUBECONFIG="$KUBECONFIG:$contextFile"
done
IFS="$OIFS"
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
echo "Setup github personal token"
export GITHUB_PAT="{{ onepasswordRead "op://dotfiles/cdvvddh7rrfmtmgpmtay3j7q54/credential"}}"
export HOMEBREW_GITHUB_API_TOKEN=${GITHUB_PAT}
# Setting up nvm
echo "Set up nvm"
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && \. "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# Set up dotnet
if which -s dotnet; then
export PATH="${HOME}/.dotnet/tools/:${PATH}"
fi
# Setting up python for Monteray 12.3 and above
export PATH="/usr/local/opt/[email protected]/libexec/bin:$PATH"
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
echo "Setup sdkman..."
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"