-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathzshrc
More file actions
152 lines (117 loc) · 4.38 KB
/
zshrc
File metadata and controls
152 lines (117 loc) · 4.38 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Zsh configuration
# All settings in a single file with section separators
# ── Environment ────────────────────────────────────────────
# Global environment (moved from zshenv)
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-${HOME}/.config}
export DOTRCDIR=${DOTRCDIR:-$XDG_CONFIG_HOME/dotrc}
export HOMEBREW_PREFIX=${HOMEBREW_PREFIX:-$(brew --prefix)}
# Ensure path arrays do not contain duplicates.
typeset -gU path fpath
# Set the list of directories that zsh searches for commands.
path=(
${HOME}/{,s}bin(N)
${HOME}/.local/{,s}bin(N)
/opt/{homebrew,local}/{,s}bin(N)
/usr/local/{,s}bin(N)
$path
)
## ENV
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# amp
if [[ -d "${HOME}/.amp/bin" ]]; then
export PATH="${HOME}/.amp/bin:${PATH}"
fi
# JetBrains Toolbox CLI scripts
if [[ -d "${HOME}/Library/Application Support/JetBrains/Toolbox/scripts" ]]; then
export PATH="${PATH}:${HOME}/Library/Application Support/JetBrains/Toolbox/scripts"
fi
# Obsidian CLI
if [[ -d "/Applications/Obsidian.app" ]]; then
export PATH="${PATH}:/Applications/Obsidian.app/Contents/MacOS"
fi
# ── History ────────────────────────────────────────────────
setopt HIST_IGNORE_ALL_DUPS
# ── Plugins ────────────────────────────────────────────────
# zimfw
ZIM_HOME=${XDG_CONFIG_HOME}/zim
ZIM_CONFIG_FILE=${DOTRCDIR}/zimrc
## Initialize zimfw (installed via Homebrew)
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZIM_CONFIG_FILE} ]]; then
source ${HOMEBREW_PREFIX}/opt/zimfw/share/zimfw.zsh init
fi
source ${ZIM_HOME}/init.zsh
zstyle ':zim:zim:zim' use 'degit'
## zsh-autosuggestions
ZSH_AUTOSUGGEST_MANUAL_REBIND=1
## zsh-syntax-highlighting
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
## zsh-history-substring-search
zmodload -F zsh/terminfo +p:terminfo
# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init
for key ('^[[A' '^P' ${terminfo[kcuu1]}) bindkey ${key} history-substring-search-up
for key ('^[[B' '^N' ${terminfo[kcud1]}) bindkey ${key} history-substring-search-down
for key ('k') bindkey -M vicmd ${key} history-substring-search-up
for key ('j') bindkey -M vicmd ${key} history-substring-search-down
unset key
# ── Tools ──────────────────────────────────────────────────
# mise (activate first — sets up PATH for managed tools)
if [[ -x "${HOME}/.local/bin/mise" ]]; then
eval "$("${HOME}/.local/bin/mise" activate zsh)"
fi
# starship
if (( $+commands[starship] )); then
eval "$(starship init zsh)"
fi
# fzf
if (( $+commands[fzf] )); then
source <(fzf --zsh)
fi
# zoxide
if (( $+commands[zoxide] )); then
eval "$(zoxide init zsh)"
fi
# ── Aliases ────────────────────────────────────────────────
# System update function
function update_system() {
brew update
brew upgrade
zimfw update && zimfw upgrade
brew cleanup
mise self-update && mise up
# gh ext upgrade --all
}
# Benchmark Zsh startup time
function benchmark_zsh() {
${DOTRCDIR}/scripts/benchmark.sh "$@"
}
# Profile Zsh startup (show timing per module)
function profile_zsh() {
${DOTRCDIR}/scripts/profile-startup.zsh
}
# Update alias
alias update=update_system
# Zsh optimization aliases
alias zbench=benchmark_zsh
alias zprofile=profile_zsh
# Homebrew aliases
alias bws="brew search"
alias bwi="brew install"
# Modern CLI tool aliases
alias ls="eza --icons=auto --group-directories-first --git"
alias ll="eza -l --git --icons=auto"
alias lt="eza -l --tree --icons=auto"
alias cat="bat"
alias vi="vim"
# ── Local ──────────────────────────────────────────────────
# Work-specific config (gitignored)
if [[ -f ${HOME}/.zshrc.work ]]; then
source ${HOME}/.zshrc.work
fi
# 1Password CLI plugins
if [[ -f ${XDG_CONFIG_HOME}/op/plugins.sh ]]; then
source ${XDG_CONFIG_HOME}/op/plugins.sh
fi
# Added by LM Studio CLI (lms)
export PATH="$PATH:/Users/ujuc/.lmstudio/bin"
# End of LM Studio CLI section