Skip to main content

iTerm2 配置

安装

使用 homebrew 进行安装

brew cask install iterm2

主题

安装

  1. Solarized Dark theme
  2. Solarized Light theme

配置

  1. Preferences -> Profiles -> Colors -> Color Presets

Oh My Zsh

安装

Install with curl

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

Install with wget

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

主题

安装 Powerlevel10k

git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

修改

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

字体

  • 安装 hack-nerd-font 字体(字体网站)
    brew tap homebrew/cask-fonts
    brew cask install font-hack-nerd-font
  • 安装 PowerLine 字体(解决乱码)
    cd ~/Downloads
    git clone https://github.com/powerline/fonts.git
    cd fonts
    bash install.sh
  • 配置(选择 For PowerLine 的字体)
    1. Preferences -> Profiles -> Text -> Change Font

插件

语法高亮插件 zsh-syntax-highlighting

  1. 运行

    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
    vim ~/.zshrc
  2. i 进入编辑

  3. plugins 配置,增加 zsh-syntax-highlighting

  4. 运行 source ~/.zshrc

自动填充插件 zsh-autosuggestions

  1. 运行

    git clone https://github.com/zsh-users/zsh-autosuggestions.git ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
    vim ~/.zshrc
  2. i 进入编辑

  3. plugins 配置,增加 zsh-autosuggestions

  4. 运行 source ~/.zshrc

常见问题

  • 权限问题

    运行

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

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

    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..