Loading...
Loading...
在 macOS 系统上安装和配置 Oh My Zsh 及 Powerlevel10k 主题的完整指南。当用户需要美化终端、安装 oh-my-zsh、配置 powerlevel10k 主题、安装 Nerd Fonts 字体、或配置 iTerm2 颜色主题时使用此 skill。
npx skill4agent add svensxl/svenskills ohmyzsh-p10kscripts/install.shscripts/install.shcp ~/.zshrc ~/.zshrc.backup.$(date +%Y%m%d%H%M%S)sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended --keep-zshrc关键:使用避免覆盖已有的--keep-zshrc配置。.zshrc
brew install --cask font-meslo-lg-nerd-fontPreferences → Profiles → Text偏好设置 → 配置文件 → 文本git clone --depth=1 https://github.com/romkatv/powerlevel10k.git \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10kbrew install eza # 现代化的 ls 替代工具
brew install zoxide # 智能 cd 替代工具# 命令自动建议
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# 命令输入实时语法高亮
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# 按片段搜索历史命令
git clone --depth=1 https://github.com/zsh-users/zsh-history-substring-search \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search.zshrcZSHsourceexport ZSH="$HOME/.oh-my-zsh"ZSH_THEMEsed -i '' 's/^ZSH_THEME=.*/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc.zshrcplugins=(...)plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
eza
history-substring-search
jsontools
history
copyfile
copybuffer
copypath
extract
command-not-found
zoxide
)pluginssourcesource $ZSH/oh-my-zsh.sh注意:必须放在source $ZSH/oh-my-zsh.sh之后,因为 Oh My Zsh 在加载时会读取 plugins 变量来决定启用哪些插件。plugins=(...)
p10k configure| 插件 | 类型 | 功能 |
|---|---|---|
| git | 内置 | Git 命令别名和补全 |
| zsh-autosuggestions | 第三方 | 根据历史记录自动建议命令 |
| zsh-syntax-highlighting | 第三方 | 命令输入实时语法高亮 |
| history-substring-search | 第三方 | 按↑↓键基于片段搜索历史命令 |
| eza | 内置 | 为 eza(现代 ls)提供别名 |
| zoxide | 内置 | 为 zoxide(智能 cd)提供集成 |
| jsontools | 内置 | JSON 格式化工具(pp_json 等) |
| history | 内置 | 历史命令管理别名 |
| copyfile | 内置 | 复制文件内容到剪贴板 |
| copybuffer | 内置 | Ctrl+O 复制当前命令行到剪贴板 |
| copypath | 内置 | 复制当前路径到剪贴板 |
| extract | 内置 | 智能解压各种压缩格式 |
| command-not-found | 内置 | 命令未找到时提示安装方式 |
git clone --depth=1 https://github.com/mbadolato/iTerm2-Color-Schemes.git ~/iTerm2-Color-SchemesPreferences → Profiles → Colors → Color Presets → Import~/iTerm2-Color-Schemes/schemes/.itermcolorsgit clone https://github.com/powerline/fonts.git --depth=1 /tmp/powerline-fonts
cd /tmp/powerline-fonts && ./install.sh
rm -rf /tmp/powerline-fontsbrew install fontconfig # 如果 fc-list 命令不存在
fc-list | grep -i meslop10k configure