-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.zshrc
234 lines (190 loc) · 5.7 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# -------------------
# Shell configuration
# -------------------
# Path to oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Starship init
eval "$(starship init zsh)"
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
fpath+="$HOMEBREW_PREFIX"/share/zsh/site-functions
# Source oh-my-zsh
source "$ZSH/oh-my-zsh.sh"
# ZSH syntax highlighting
source "$HOMEBREW_PREFIX/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
# -----------------
# App configuration
# -----------------
# FZF
[ -f ~/.fzf.zsh ] && source "$HOME/.fzf.zsh"
# pnpm
export PNPM_HOME="$HOME/Library/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# pnpm end
# zoxide
eval "$(zoxide init zsh)"
# -------
# ENV
# -------
# Set preferred editor for local and remote sessions
export EDITOR='nvim'
# Set manpath
export MANPATH="/usr/local/man:$MANPATH"
# Add local bins to path
export PATH="$PATH:$HOME/.foundry/bin"
export PATH="$PATH:$HOME/.huff/bin"
export PATH="$PATH:$HOME/.local/bin"
export PATH="$PATH:/usr/local/go/bin"
export ETH_RPC=https://eth-mainnet.g.alchemy.com/v2/Y2SGiriVdroLNFmXB6TzCAOTV4RPbotK
export OP_MAINNET_ANTON=http://anton.clab.by:8547
export OP_SEPOLIA_ANTON=http://anton.clab.by:8548
export ETH_ANTON=http://anton.clab.by:8545
export SEPOLIA_ANTON=http://anton.clab.by:8546
export ETH_RPC_URL=$ETH_ANTON
# tmux colors
export TERM=xterm-256color
export OP_MONOREPO="$HOME/dev/optimism/monorepo"
# -----------
# Completions
# -----------
eval "$(cast completions zsh)"
eval "$(gh completion -s zsh)"
eval "$(gt completion zsh)"
eval "$(just --completions zsh)"
# -------
# ALIASES
# -------
# Graphite
alias gs="gt sync"
alias gco="gt co"
alias gsr="gt restack"
# Cargo
alias cg="cargo"
alias stone="cargo +nightly fmt -- && cargo +nightly clippy --all --all-features -- -D warnings"
alias rock="cargo +nightly fmt"
alias nt="cargo nextest"
alias nnt="cargo +nightly nextest"
alias spring-clean="cargo clean-all --keep-days 7 ~ -y"
# Go
alias gts="gotestsum --format=testname"
# Neovim
alias n="nvim -i NONE"
# Misc
alias c="clear"
# PNPM
alias p="pnpm"
# lazygit
alias lg="lazygit"
# SSH
alias sa="ssh [email protected]"
# Tmux
function t {
if [ -n "$1" ]; then
tmux new -s "$1"
else
tmux new -s code
fi
}
# Cat
alias cat="bat"
# Delta
alias diff="delta"
# lsd aliases
alias ls="lsd"
alias la="lsd -lah"
alias ll="lsd -lh"
alias lt="lsd --tree"
# Wttr
CITY="Atlanta"
wttr() {
if [ "$1" = "-v2" ]; then
curl -L "https://v2.wttr.in/$CITY?u"
else
curl -L "https://wttr.in/$CITY?u"
fi
}
# Forge shortcuts
ft() {
if [ $# -ge 1 ]; then
forge test "$@"
else
forge test
fi
}
ftt() {
if [ $# -ge 1 ]; then
forge test --match-test "$@"
fi
}
ftc() {
if [ $# -ge 1 ]; then
forge test --match-contract "$@"
fi
}
# Forge ETH RPCs
rpc() {
if [ "$1" = "eth" ]; then
export ETH_RPC_URL=$ETH_ANTON
elif [ "$1" = "sepolia" ]; then
export ETH_RPC_URL=$SEPOLIA_ANTON
elif [ "$1" = "op" ]; then
export ETH_RPC_URL=$OP_MAINNET_ANTON
elif [ "$1" = "op-sepolia" ]; then
export ETH_RPC_URL=$OP_SEPOLIA_ANTON
else
export ETH_RPC_URL=""
fi
}
# ------------
# `gh` aliases
# ------------
# Search through all PRs that are open in the current repo and open the selected one in browser.
alias prv="GH_FORCE_TTY=100% gh pr list -L 1000 | fzf --ansi --preview 'GH_FORCE_TTY=100% gh pr view {1}' --preview-window down --header-lines 4 | cut -d' ' -f1 | tr -d '#' | xargs gh pr view -w"
# Search through all PRs that are open in the current repo and check the selected one out locally.
alias prc="GH_FORCE_TTY=100% gh pr list -L 1000 | fzf --ansi --preview 'GH_FORCE_TTY=100% gh pr view {1}' --preview-window down --header-lines 4 | cut -d' ' -f1 | tr -d '#' | xargs gh pr checkout"
# Search through all PRs that are open in the current repo and that I'm requested to review and
# open the selected one in browser.
alias prr="GH_FORCE_TTY=100% gh pr list --search 'user-review-requested:@me' | fzf --ansi --preview 'GH_FORCE_TTY=100% gh pr view {1}' --preview-window down --header-lines 3 | cut -d' ' -f1 | tr -d '#' | xargs gh pr view -w"
# Search through all open client-pod issues and open the selected one in browser.
alias is="GH_FORCE_TTY=100% gh issue list -L 1000 | fzf --ansi --preview 'GH_FORCE_TTY=100% gh issue view {1}' --preview-window down --header-lines 4 | cut -d' ' -f1 | tr -d '#' | xargs gh issue view -w"
# Search through all open client-pod issues assigned to me and open the selected one in browser.
alias isa="GH_FORCE_TTY=100% gh issue list -L 1000 --search 'assignee:@me' | fzf --ansi --preview 'GH_FORCE_TTY=100% gh issue view {1}' --preview-window down --header-lines 4 | cut -d' ' -f1 | tr -d '#' | xargs gh issue view -w"
alias gst="gh status"
# Open the repo in-browser
repo() {
if type gh &> /dev/null; then
gh repo view -w
else
echo "gh is not installed"
fi
}
# Open the github TUI
ghd() {
if type gh &> /dev/null; then
gh dash
else
echo "gh is not installed"
fi
}
# Search through all PRs that meet a supplied filter and open the selected one in browser.
prf() {
if type gh &> /dev/null; then
if [ $# -eq 1 ]; then
GH_FORCE_TTY=100% gh pr list --search "$@" | fzf --ansi --preview 'GH_FORCE_TTY=100% gh pr view {1}' --preview-window down --header-lines 3 | cut -d' ' -f1 | tr -d '#' | xargs gh pr view -w
else
echo "Filter arguments are required."
fi
else
echo "gh is not installed"
fi
}
# Clipboard
xc() {
if [ "$(uname)" = "Darwin" ]; then
pbcopy
else
xclip -selection clipboard
fi
}