Zsh 配置

基本配置

安裝 Zsh:

# Ubuntu/Debian
sudo apt install zsh

# macOS
brew install zsh

macOS 默认使用 Zsh,可以不用重复安装。

安装配置框架 Oh My Zsh:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

插件

  • 安装插件 zsh-syntax-highlighting

    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    

    ~/.zshrc 中激活插件:

    plugins=( [其他 plugin...] zsh-syntax-highlighting)  # zsh-syntax-highlighting 必须放在最后
    
  • 安装插件 zsh-autosuggestions

    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    

    ~/.zshrc 中激活插件:

    plugins=( [其他 plugin...] zsh-autosuggestions)
    
  • 安装插件 zsh-proxy

    git clone https://github.com/sukkaw/zsh-proxy.git ~/.oh-my-zsh/custom/plugins/zsh-proxy
    

    ~/.zshrc 中激活插件:

    plugins=( [其他 plugin...] zsh-proxy)
    
  • 安装 Zsh 主题 Powerlevel10k

    1. 克隆 Powerlevel10k 存储库:

      git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
      
    2. ~/.zshrc 中更改主题设置:

      ZSH_THEME="powerlevel10k/powerlevel10k"
      
    3. 下载并安装字体 MesloLG Nerd Font:

      mv MesloLGMNerdFontMono-*.ttf ~/.local/share/fonts
      
    4. 打开终端设置,启用 Custom font 并设置为 MesloLGM Nerd Font Mono

      image

posted @ 2024-07-31 20:20  Undefined443  阅读(5)  评论(0编辑  收藏  举报