9

使用iTerm2和oh-my-zsh美化Mac终端

 2 years ago
source link: http://huanyouchen.github.io/2020/06/26/mac-beautify-terminal-based-on-iTerm2-oh-my-zsh/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
幻悠尘的小窝

The quieter you become,the more you are able to hear.

使用iTerm2和oh-my-zsh美化Mac终端

最终效果图:

美化后的终端

美化后的终端

需要安装的清单有:

  1. 安装iTerm2,然后依次打开 Preferences-Appearance-General-Theme,选择Minimal。
  2. 下载安装Dracula主题
$ git clone https://github.com/dracula/iterm.git

​ 然后按照官网描述的步骤安装即可,完成后:

Dracula主题设置Dracula主题设置

  1. 设置背景图片,依次打开iTerm2-Preferences-Profiles-windows-Background Image,选择enable,然后选择自己喜欢的图片,我选择的是漫画《鬼刀》里的一张高清图片,设置图片的背景透明度可以拖动Blending旁边的滑动条实现。图片资源地址点击这里

    iTerm2背景图片iTerm2背景图片

  1. 设置显示信息。依次打开iTerm2-Preferences–Session,勾选Status bar enable,Configure Status Bar,把上面的一些功能拖动到下面的框框里即可。我选择了当前文件夹,网速和搜索。打开Preferences-Window-Window custom title,填入想要的标题,我填的是iMac。

  2. 将默认shell设为zsh,

    chsh -s /bin/zsh
    echo $SHELL
    # 输出 /bin/zsh

    然后安装oh my zsh,

    sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  3. 安装Spaceship 主题,首先按照官网给的步骤下载:

    git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt"

    ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"

    然后打开~/.zshrc,将ZSH_THEME修改为ZSH_THEME="spaceship"。最后source ~/.zshrc重新加载配置文件。

  4. 下载Powerline fonts:

    # clone
    git clone https://github.com/powerline/fonts.git --depth=1
    # install
    cd fonts
    ./install.sh
    # clean-up a bit
    cd ..
    rm -rf fonts

    设置字体,依次打开iTerm2-Preferences-Text-Font,我选择的是Fira Mono for Powerline字体。

  5. 安装插件zsh-syntax-highlightingzsh-autosuggestions

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

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

    然后在~/.zshrc中,添加插件:

    # Add wisely, as too many plugins slow down shell startup.
    plugins=(git z osx extract zsh-syntax-highlighting zsh-autosuggestions)

    其中,z,osx,extract是oh-my-zsh自带的插件,可以选择添加。添加完成后,再次执行source ~/.zshrc

​ 至此,美化过程结束。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK