-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_zshrc
More file actions
96 lines (77 loc) · 2.31 KB
/
dot_zshrc
File metadata and controls
96 lines (77 loc) · 2.31 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
export PATH="/opt/homebrew/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/.utoo-proxy:$PATH"
# ========== Mirrors ==========
export ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"
export HOMEBREW_NO_AUTO_UPDATE=1
# ========== Shell Completions ==========
fpath=("$HOME/.zsh/completions" $fpath)
autoload -Uz compinit && compinit
# ========== Oh My Zsh ==========
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="catppuccin" # classic | catppuccin
# Add wisely, as too many plugins slow down shell startup.
# plugins=(git)
source $ZSH/oh-my-zsh.sh
# ========== Setup ==========
eval "$(fnm env --shell zsh)" # --use-on-cd
eval "$(zoxide init zsh)"
eval "$(starship init zsh)"
# ========== Uitls ==========
# yazi
export EDITOR=subl
y() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
command yazi "$@" --cwd-file="$tmp"
IFS= read -r -d '' cwd < "$tmp"
[ "$cwd" != "$PWD" ] && [ -d "$cwd" ] && builtin cd -- "$cwd"
rm -f -- "$tmp"
}
# ripgrep + fzf
rgf() {
if [[ $# -eq 0 ]]; then
echo "Usage: rgf <string> [rg options...]" >&2
return 1
fi
local string="$1"
shift
# -F, --fixed-strings Treat all patterns as literals.
rg -l -F "$string" "$@" | fzf \
--preview "rg -n --color=always -C 3 -F -- '$string' {}" \
--preview-window="right:60%:wrap" \
--bind "ctrl-/:toggle-preview" \
--header="Ctrl-/ to toggle preview" \
--delimiter=":" \
--with-nth=1
}
# geolocation
geo() {
local ip="$1"
if [[ -z "$ip" ]]; then
ip="$(curl -s https://ifconfig.co/ip 2>/dev/null)"
fi
curl -s "http://ip-api.com/json/$ip" | jq .
}
# nosleep
nosleep() {
local h=${1:-8}
local word=$([[ $h > 1 ]] && echo "hours" || echo "hour")
printf "System will stay awake for %d %s..." "$h" "$word"
caffeinate -t $((h*3600))
}
# ========== Check IP before launching Claude Code ==========
source "$HOME/.zsh/Check-IP-before-launching-Claude-Code.zsh"
# ========== Alias ==========
alias g="lazygit"
alias ss="starship"
alias agb="agent-browser"
alias cz="chezmoi"
alias nls="time npm ls -g --depth=0"
alias findDS="fd -IHg '**/.DS_Store'"
alias cleanDS="fd -IHg '**/.DS_Store' -X rm"
alias ip="curl -s https://ifconfig.co/ip"
alias l="lsd"
alias ll="lsd -A"
alias la="lsd -lA --git"
# ========== EOF ==========