题图来源:iterm2

以下是个人配置,使用Powerlevel10k主题

安装(使用Brew进行安装)

1
brew cask install iterm2

主题

Oh My Zsh

  • 安装

    • Install with curl

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

      1
      sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
  • 主题

    • Powerlevel10k

      1
      git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
  • 修改

    1
    2
    3
    4
    5
    6
    7
    vim ~/.zshrc
    # i 进入编辑
    # 找到 ZSH_THEME="robbyrussell" 这一行
    # 修改为 ZSH_THEME="agnoster"
    # 或者 ZSH_THEME="powerlevel10k/powerlevel10k"
    # 保存退出 esc + :wq
    source ~/.zshrc

字体

  • 安装hack-nerd-font字体(字体网站)

    1
    2
    brew tap homebrew/cask-fonts
    brew cask install font-hack-nerd-font
  • 安装PowerLine字体(解决乱码)

    1
    2
    3
    4
    cd ~/Downloads
    git clone https://github.com/powerline/fonts.git
    cd fonts
    bash install.sh
  • 配置(选择For PowerLine的字体)

    1. Preferences -> Profiles -> Text -> Change Font

插件

  • 语法高亮插件

    1
    2
    3
    4
    5
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
    vim ~/.zshrc
    # i 进入编辑
    # plugins配置,增加zsh-syntax-highlighting
    source ~/.zshrc
  • 自动填充插件

    1
    2
    3
    4
    5
    git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
    vim ~/.zshrc
    # i 进入编辑
    # plugins配置,增加zsh-autosuggestions
    source ~/.zshrc
  • 自动填充插件(另外一种方法)

    1
    git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

问题

  • 权限问题

    1
    2
    chmod 755 /usr/local/share/zsh
    chmod 755 /usr/local/share/zsh/site-functions
  • zsh: command not found: xxx

    1
    2
    3
    4
    5
    6
    7
    vim ~/.zshrc
    # i 进入编辑
    # 找到『# User configuration』这行
    # 在下方添加 『source ~/.bash_profile』
    # 保存退出esc + :wq
    source ~/.zshrc
    # 重启命令行
  • Auto suggestions No show

    1
    If the auto suggestions do not appear to show, it could be a problem with your color scheme. Under "iTerm → Preferences → Profiles → Colors tab", check the value of Black Bright, that is the color your auto suggestions will have. It will be displayed on top of the Background color. If there is not enough contrast between the two, you won't see the suggestions even if they're actually there..