首页 iTerm配置
文章
取消

iTerm配置

首先要安装iterm2,然后就是各种折腾了。

  1. 安装zsh

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

    1
    2
    3
    4
    
    # 先安装pip指令
    sudo easy_install pip
    # 安装管道
    pip install --user powerline-status
    
  3. 安装powerline字体,为后面的ZSH主题作准备

    1
    2
    3
    4
    5
    6
    7
    8
    
    # clone
    git clone https://github.com/powerline/fonts.git --depth=1
    # install
    cd fonts
    ./install.sh
    # clean-up a bit
    cd ..
    rm -rf fonts
    

    修改字体:

    修改iTerm字体

  4. 安装和配置ZSH主题

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    # 1.下载主题
    git clone https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor
    # 2.安装主题
    cd oh-my-zsh-agnoster-fcamblor
    ./install
    # 3.修改配置文件
    vim .zshrc
    # TODO 修改如下内容
    ZSH_THEME="agnoster"
    # 修改完之后 使之生效
    source .zshrc
    
  5. 隐藏用户名和主机名

    1
    2
    3
    4
    5
    6
    7
    
    # 我的名字用户名和主机名是:gongchunru@gongchunrudeMBP
    # 修改 .zshrc文件
    vim .zshrc
    # 在文件内添加如下内容
    DEFAULT_USER="gongchunru"
    # 记得以下
    source .zshrc
    
  6. 安装语法高亮插件 zsh-syntax-highlighting

    1
    2
    3
    4
    5
    6
    
    # 1. 下载安装插件
    brew install zsh-syntax-highlighting
    # 2. 添加配置在 .zshrc
    source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
    # 3. 使之生效
    source .zshrc
    
  7. 安装自动提示插件 zsh-autosuggestions

    1
    2
    3
    4
    5
    6
    
    # 1. 下载安装插件
    brew install zsh-autosuggestions
    # 2. 添加配置 .zshrc
    source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
    # 3. 使之生效
    source .zshrc
    
  8. 遇到的问题:

    1
    2
    3
    
    # 自动提示的代码颜色不对,看不到内容。
    # 修改文件 /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
    ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10'
    
本文由作者按照 CC BY 4.0 进行授权

-

计算机科学