-
Notifications
You must be signed in to change notification settings - Fork 1
/
dot_zshrc
169 lines (141 loc) · 8.99 KB
/
dot_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
# ---------------------------------------------------------------------------------------------------------------------
# Oh My Zsh!
# ---------------------------------------------------------------------------------------------------------------------
# Path to your oh-my-zsh installation
export ZSH="$HOME/.oh-my-zsh"
# Disable automatic updates
zstyle ':omz:update' mode disabled
# Theme (https://github.com/ohmyzsh/ohmyzsh/wiki/Themes)
ZSH_THEME="alanpeabody"
# Specify cache dir outside of the Oh My Zsh installation
ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/ohmyzsh"
# Enable command auto-correction
# ENABLE_CORRECTION="true"
# Display red dots whilst waiting for completion
COMPLETION_WAITING_DOTS="true"
# Disable marking untracked files under VCS as dirty (slow on big repos)
DISABLE_UNTRACKED_FILES_DIRTY="true"
# Command execution time stamp shown in the history command output
HIST_STAMPS="dd.mm.yyyy"
# Plugins
plugins=(
aliases # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/aliases
aws # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/aws
direnv # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/direnv
encode64 # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/encode64
gitignore # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/gitignore
golang # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/golang
gpg-agent # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/gpg-agent
heroku # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/heroku
istioctl # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/istioctl
kubectl # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/kubectl
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/kubectx
macos # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/macos
man # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/man
npm # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/npm
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/pass
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/ssh-agent
terraform # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/terraform
thefuck # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/thefuck
vscode # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/vscode
yarn # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/yarn
zsh-syntax-highlighting
)
# Init Oh My Zsh
source $ZSH/oh-my-zsh.sh
# ---------------------------------------------------------------------------------------------------------------------
# Aliases & functions
# ---------------------------------------------------------------------------------------------------------------------
alias cat="bat"
alias gitdaemon="gitserve"
alias gitserve="git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose"
alias kind-reset="kreset"
alias kreset="kind delete cluster && curl -fsSL https://raw.githubusercontent.com/tilt-dev/kind-local/master/kind-with-registry.sh | bash"
alias ls="exa --header --git --group-directories-first --group --oneline"
alias pr="gh pr create --fill; gh pr edit --add-label automerge; gh pr view --web"
alias rebase="current=\$(git branch --show-current); git stash; git switch main; git pull; git switch $current; git rebase; git unstash"
alias rm="trash"
alias serve="http-server -o"
alias uncommit="git reset --soft HEAD^"
alias zshrc="chezmoi edit ~/.zshrc --apply"
fpath=( ~/.zfuncs "${fpath[@]}" )
freload() { while (( $# )); do; unfunction $1; autoload -U $1; shift; done }
autoload -Uz helm
autoload -Uz kc
autoload -Uz ks
# ---------------------------------------------------------------------------------------------------------------------
# Android Studio
# ---------------------------------------------------------------------------------------------------------------------
export ANDROID_HOME="$HOME/Library/Android/sdk"
export ANDROID_SDK_ROOT="$HOME/Library/Android/sdk"
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin; PATH=$PATH:$ANDROID_HOME/emulator; PATH=$PATH:$ANDROID_HOME/platform-tools
# ---------------------------------------------------------------------------------------------------------------------
# Bat
# https://github.com/sharkdp/bat
# ---------------------------------------------------------------------------------------------------------------------
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
# ---------------------------------------------------------------------------------------------------------------------
# Chezmoi
# ---------------------------------------------------------------------------------------------------------------------
command -v chezmoi >/dev/null && . <(chezmoi completion zsh)
# ---------------------------------------------------------------------------------------------------------------------
# DirEnv
# ---------------------------------------------------------------------------------------------------------------------
export DIRENV_LOG_FORMAT=""
# ---------------------------------------------------------------------------------------------------------------------
# Flux
# ---------------------------------------------------------------------------------------------------------------------
command -v flux >/dev/null && . <(flux completion zsh)
# ---------------------------------------------------------------------------------------------------------------------
# Go
# ---------------------------------------------------------------------------------------------------------------------
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
# ---------------------------------------------------------------------------------------------------------------------
# Google Cloud SDK
# ---------------------------------------------------------------------------------------------------------------------
source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"
source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc"
# ---------------------------------------------------------------------------------------------------------------------
# Homebrew
# ---------------------------------------------------------------------------------------------------------------------
export HOMEBREW_CASK_OPTS=--no-quarantine
# ---------------------------------------------------------------------------------------------------------------------
# GPG
# ---------------------------------------------------------------------------------------------------------------------
alias pinentry="pinentry-mac"
export GPG_TTY=$(tty)
# ---------------------------------------------------------------------------------------------------------------------
# SSH
# ---------------------------------------------------------------------------------------------------------------------
# SSH with secretive
# It is more user-friendly than using a GPG subkey because I don't need to have
# my hardware key with me to SSH or sign commits.
export SSH_AUTH_SOCK=$HOME/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh
# SSH with SmartCard (Yubikey/Ledger)
# export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
# gpgconf --launch gpg-agent
# ---------------------------------------------------------------------------------------------------------------------
# Starship
# ---------------------------------------------------------------------------------------------------------------------
eval "$(starship init zsh)"
# ---------------------------------------------------------------------------------------------------------------------
# Terraform
# ---------------------------------------------------------------------------------------------------------------------
# https://github.com/hashicorp/terraform/issues/21271#issuecomment-491424517
unsetopt nomatch
# ---------------------------------------------------------------------------------------------------------------------
# TheFuck
# ---------------------------------------------------------------------------------------------------------------------
eval "$(thefuck --alias)"
# ---------------------------------------------------------------------------------------------------------------------
# Volta
# ---------------------------------------------------------------------------------------------------------------------
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
# https://github.com/volta-cli/volta/issues/927
volta-migrate --no-create 1>/dev/null
# ---------------------------------------------------------------------------------------------------------------------
# Other stuff (may be legacy)
# ---------------------------------------------------------------------------------------------------------------------
export CURRENT_AWS="echo \"\${AWS_PROFILE:-default}(\${AWS_DEFAULT_REGION:-\${AWS_REGION:-\$(cat ~/.aws/config | sed -n -E \"/\\\[((profile \$AWS_PROFILE)|\${AWS_PROFILE:-default})\\\]/,/\\[/p;/\\\[/d\" | grep region | cut -f2- -d=)}})\""