configuring-zsh
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseZsh Shell Configuration
Zsh Shell 配置
Quick Reference
快速参考
| Topic | Reference |
|---|---|
| Startup file order | startup-files.md |
| oh-my-zsh patterns | oh-my-zsh.md |
| powerlevel10k setup | powerlevel10k.md |
| sheldon plugin manager | sheldon.md |
| Plugin load order | plugins.md |
| Performance tuning | performance.md |
| 主题 | 参考文档 |
|---|---|
| 启动文件顺序 | startup-files.md |
| oh-my-zsh 模式 | oh-my-zsh.md |
| powerlevel10k 设置 | powerlevel10k.md |
| sheldon 插件管理器 | sheldon.md |
| 插件加载顺序 | plugins.md |
| 性能调优 | performance.md |
Workflow Decision Tree
工作流决策树
| Need to... | Action |
|---|---|
| Set env vars / PATH / locales | Read |
| Configure aliases, keybinds, completions, prompt | Edit |
| Fix performance issues | Read |
| Add/configure plugins | Read |
| 需求 | 操作 |
|---|---|
| 设置环境变量 / PATH / locales | 阅读 |
| 配置别名、按键绑定、补全和提示符 | 编辑 |
| 解决性能问题 | 阅读 |
| 添加或配置插件 | 阅读 |
Chezmoi Integration
Chezmoi 集成
- Edit Zsh configs in the chezmoi source (this repo), not directly in
~ - Respect template blocks in files
{{ ... }} - Source naming: →
dot_zshrc,~/.zshrc→private_dot_config/sheldon~/.config/sheldon - For chezmoi workflows, see skill
managing-chezmoi
- 在 chezmoi 源目录(本仓库)中编辑 Zsh 配置,而不是直接在 中编辑
~ - 遵循文件中的 模板块
{{ ... }} - 源文件命名:→
dot_zshrc,~/.zshrc→private_dot_config/sheldon~/.config/sheldon - 对于 chezmoi 工作流,请参阅 skill
managing-chezmoi
Default Guardrails
默认防护规则
- Keep idempotent and fast; no external commands
.zshenv - No aliases/functions in
.zshenv - Use or
typeset -gx VAR=...with defensive checksexport VAR=... - Set before
fpath; runcompinitonce onlycompinit - Document plugin load order (especially +
zsh-autocomplete)zsh-syntax-highlighting
- 确保 保持 idempotent 且执行快速;不要调用外部命令
.zshenv - 不要在 中定义 aliases/functions
.zshenv - 使用 或
typeset -gx VAR=...,并采用防御性检查export VAR=... - 在 之前设置
compinit;仅运行一次fpathcompinit - 记录插件加载顺序(尤其是 +
zsh-autocomplete)zsh-syntax-highlighting
Common Tasks
常见任务
| Task | Approach |
|---|---|
| Add env var | |
| Fix PATH | Ensure ordering, remove duplicates, avoid |
| Enable completions | Set |
| Add plugin | Choose manager → ensure correct load order |
| Setup p10k | Instant prompt block first in |
| 任务 | 方法 |
|---|---|
| 添加环境变量 | |
| 修复 PATH | 确保顺序正确、移除重复项,避免在多个文件中使用 |
| 启用补全 | 设置 |
| 添加插件 | 选择管理器 → 确保加载顺序正确 |
| 配置 p10k | 将 instant prompt 代码块放在 |