-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
147 lines (106 loc) · 3.18 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
export PROMPT="%n@%m%\:%~$ "
export RPROMPT="%(?..%?)"
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="robbyrussell"
plugins=(git kube-ps1 docker docker-compose)
source $ZSH/oh-my-zsh.sh
# ~/bin
[ -d "${HOME}/bin" ] && export PATH="${HOME}/bin:${PATH}"
[ -d "${HOME}/.yarn/bin" ] && export PATH="${HOME}/.yarn/bin:${PATH}"
[ -d "${HOME}/.local/bin" ] && export PATH="${HOME}/.local/bin:${PATH}"
# Individual history per tab
#
# See: https://superuser.com/a/1248123/675796
unsetopt inc_append_history
unsetopt share_history
# Git
alias st='git status'
alias sta='git status --untracked-files=all'
alias di='git diff'
alias dis='git diff --staged'
alias dit='git diff | tig'
alias dist='git diff --staged | tig'
alias ci='git commit'
alias co='git checkout'
alias sw='git switch'
alias br='git branch'
alias ad='git add'
alias fa='git fetch --all --prune'
alias ga='gitk --all'
alias glo='git log --oneline '
alias guo='slu git url open'
# Kubernetes
alias k=kubectl
alias kx=kubectx
alias kn=kubens
alias kdev="slu kdev "
alias ddev="slu ddev "
# Old aliases without slu
# alias kdev="kubectl run dev-$(date +%s) --rm -ti --image sikalabs/dev -- bash"
# alias ddev="docker run -ti -w $(pwd) -v $(pwd):$(pwd) sikalabs/dev"
# krew
export PATH="${PATH}:${HOME}/.krew/bin"
# kube-ps1
export KPS1_ACTIVE=0
function kps1() {
[[ "$KPS1_ACTIVE" == "1" ]] && return 0
export KPS1_ACTIVE=1
export KUBE_PS1_SYMBOL_ENABLE=false
export PS1='$(kube_ps1) '$PS1
}
# KUBECONFIG (for autocomple of export environment variable)
export KUBECONFIG=~/.kube/config
# Terraform
alias tf=terraform
alias tfi="terraform init"
alias tfa="terraform apply"
alias tfd="terraform destroy"
alias tfp="terraform plan"
alias tfs="terraform show"
alias tfo="terraform output"
function tfaa() {
terraform plan
echo sleep for 10 seconds ...
sleep 10
terraform apply -auto-approve
}
# Terrafor autocompletition
autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C /opt/homebrew/bin/terraform terraform
# ArgoCD
. <(argocd completion zsh); compdef _argocd argocd
alias acd="argocd "
# slu
. <(slu completion zsh); compdef _slu slu
# tergum
. <(tergum completion zsh); compdef _tergum tergum
# gobble
. <(gobble completion zsh); compdef _gobble gobble
# training-cli
. <(training-cli completion zsh); compdef _training-cli training-cli
# kaf
. <(kaf completion zsh); compdef _kaf kaf
# watch
alias watch="watch "
alias w="watch -n 0.3 "
alias viddy="viddy "
alias ww="viddy -n 0.3 "
# Fuck
eval $(thefuck --alias)
# NVM (Node Version Manager)
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# Terraform Plugin Cache (save plugins in one dir to save space)
export TF_PLUGIN_CACHE_DIR="$HOME/.terraform-plugin-cache"
# Docker
alias dra='docker ps -a -q | xargs -r docker rm -f'
alias docker-compose="docker compose "
# youtube-dl mp3
alias yd='youtube-dl --extract-audio --audio-format mp3 '
# Completion
. <(minikube completion zsh)
# History
export HISTFILE=~/.zsh_history
export HISTSIZE=999999999
export SAVEHIST=$HISTSIZE
export HISTORY_IGNORE="(MAGICSHIT|*ACCESS_KEY*|*SECRET_KEY*|*TOKEN*)"