Mac下美化iterm2使用oh-my-zsh

3,054 阅读1分钟
原文链接: www.jianshu.com

iterm2默认没有git分支 没有命令自动提示 通过下边的安装来美化iterm2

  1. 打开iterm2终端 首先 安装 zsh
    Try zsh --version before installing it from Homebrew
    执行 zsh --version 如果输出了版本号 说明已经安装过了(系统自带)
    如果没有安装执行下边命令

     brew install zsh zsh-completions
    
  2. 安装 oh-my-zsh
    必须先安装zsh 才能安装 oh-my-zsh
    安装oh-my-zsh之前 要求安装好curl或者wget以及git
    这里都已安装过
    通过curl 或者 wget 安装 oh-my-zsh
    打开终端执行以下任一命令
    // 通过curl 安装

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

    // 通过wget 安装

     sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
    
  3. 给zsh配置主题
    sudo vim ~/.zshrc
    这里可以到 github.com/robbyrussel…查看支持的主题名字
    修改 ZSH_THEME的值 这里改为cloud主题;
    ZSH_THEME="cloud"
    保存退出 重启终端 即可看到新的主题

  4. 添加命令行自动提示

    执行以下命令克隆zsh-autosuggestions到~/.zsh/zsh-autosuggestions

     sudo git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
    

    将以下内容添加到您的.zshrc

     source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
    

    开始一个新的终端会话

  5. 配置iterm2主题为 Dracula 可以参考 Dracula

    下载主题文件

     git clone https://github.com/dracula/iterm.git
    

    激活主题

     1、iTerm2 > Preferences > Profiles > Colors Tab
     2、Open the Color Presets... drop-down in the bottom right corner
     3、Select Import... from the list
     4、Select the Dracula.itermcolors file
     5、Select the Dracula from Color Presets...