安装 Oh My Zsh

Oh My Zsh是一个开源的、社区驱动的框架,用于管理您的Zsh配置.

  • 官网提供的安装方式:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

powerlevel10k

  1. Homebrew Fonts:
    > 在macOS上,并希望使用Homebrew的最佳选择。
    所有字体都可以通过macOS(OS X)上的Homebrew Cask字体获得

    brew tap homebrew/cask-fonts
    brew install --cask font-hack-nerd-font
  2. 克隆仓库:

    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

    中国大陆用户可以使用 gitee.com 上的官方镜像加速下载.

git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
  1. Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.

  2. 应用配置:

    source ~/.zshrc
  3. p10k 配置命令:

    p10k configure

命令提示和语法高亮插件安装

  • 前往插件目录下
cd ~/.oh-my-zsh/plugins
  • 安装历史命令提示插件
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
  • 安装语法高亮插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
  1. 配置插件,修改 .zshrc
nano ~/.zshrc
# 在文件里找到plugins,修改为
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
  1. 应用配置:
source ~/.zshrc