-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_zshrc
More file actions
130 lines (104 loc) · 4.23 KB
/
dot_zshrc
File metadata and controls
130 lines (104 loc) · 4.23 KB
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
# =============================================================================
# Powerlevel10k Instant Prompt (must be at top)
# =============================================================================
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
# =============================================================================
# Homebrew
# =============================================================================
eval "$(/opt/homebrew/bin/brew shellenv)"
# =============================================================================
# Oh My Zsh
# =============================================================================
export ZSH=$HOME/.oh-my-zsh
ZSH_THEME="powerlevel10k/powerlevel10k"
DISABLE_AUTO_UPDATE="true"
plugins=(git autojump zsh-autosuggestions zsh-syntax-highlighting fzf)
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=62'
source $ZSH/oh-my-zsh.sh
# =============================================================================
# Environment Variables
# =============================================================================
export XDG_CONFIG_HOME=$HOME/.config
export GPG_TTY=$(tty)
export GOROOT=$(brew --prefix golang)/libexec
export GOPATH=$HOME/go
export BUN_INSTALL="$HOME/.bun"
# =============================================================================
# PATH
# =============================================================================
path=(
/usr/local/opt/coreutils/libexec/gnubin
/usr/local/opt/make/libexec/gnubin
$GOROOT/bin
$GOPATH/bin
$HOME/.krew/bin
$HOME/.cargo/bin
$HOME/.docker/bin
/usr/local/opt/libpq/bin
/opt/homebrew/opt/gnu-sed/libexec/gnubin
$HOME/.local/bin
/opt/homebrew/opt/python@3.12/libexec/bin
/opt/homebrew/opt/openjdk/bin
$HOME/.antigravity/antigravity/bin
$BUN_INSTALL/bin
$path
)
typeset -U path
# =============================================================================
# Shell Options
# =============================================================================
setopt inc_append_history
setopt share_history
# =============================================================================
# Completions
# =============================================================================
source <(kubectl completion zsh)
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
[ -s "$HOME/.bun/_bun" ] && source "$HOME/.bun/_bun"
[ -f "$HOME/google-cloud-sdk/path.zsh.inc" ] && source "$HOME/google-cloud-sdk/path.zsh.inc"
[ -f "$HOME/google-cloud-sdk/completion.zsh.inc" ] && source "$HOME/google-cloud-sdk/completion.zsh.inc"
# =============================================================================
# Aliases
# =============================================================================
alias k=kubectl
alias kx=kubectx
alias tf=terraform
alias gcsm='git commit -S -m'
alias proxy='export all_proxy=socks5://127.0.0.1:6153'
alias unproxy='unset all_proxy'
alias tailscale="/Applications/Tailscale.app/Contents/MacOS/Tailscale"
# =============================================================================
# Functions
# =============================================================================
oc() {
local base_name=$(basename "$PWD")
local path_hash=$(echo "$PWD" | md5sum | cut -c1-4)
local session_name="${base_name}-${path_hash}"
local port=4096
while [ $port -lt 5096 ]; do
if ! lsof -i :$port >/dev/null 2>&1; then
break
fi
port=$((port + 1))
done
export OPENCODE_PORT=$port
if [ -n "$TMUX" ]; then
opencode --port $port "$@"
else
local oc_cmd="OPENCODE_PORT=$port opencode --port $port $*; exec $SHELL"
if tmux has-session -t "$session_name" 2>/dev/null; then
tmux new-window -t "$session_name" -c "$PWD" "$oc_cmd"
tmux attach-session -t "$session_name"
else
tmux new-session -s "$session_name" -c "$PWD" "$oc_cmd"
fi
fi
}
# =============================================================================
# Local Secrets (not tracked in git)
# =============================================================================
[[ -f ~/.secrets ]] && source ~/.secrets