MENU

Ultimate ZSH Customize Tutorial🚀

April 1, 2019 • Read: 363 • Note

Requirements: iTerm2

This Ultimate Tutorial aims to show you the most beautiful terminal installation steps.

1. Install Oh my zsh

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

Note: change system default terminal for Mac

zsh is another bash, configure file located at ~/.zshrc

# using zsh
chsh -s /bin/zsh
# using dash
chsh -s /bin/bash

After installation your terminal will look like this:

install_zsh_completed

2. Install PowerLine

如果是身处我大中国,那么豆瓣镜像源(或者 其他 你喜欢的)讲你是 pip 的无敌buff😆

$ vi ~/.pip/pip.conf

如果没有上述 conf 文件那就 touch 一个吧,然后添加以下配置来给 pip 加速:

[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host = pypi.douban.com

Now install powerline

# if you do not install pip
# $ sudo easy_install pip
$ pip install powerline-status --user

3. Install PowerFonts

PowerFonts is a special font for customizing zsh

$ git clone https://github.com/powerline/fonts.git --depth=1
$ cd fonts
$ ./install.sh

Then you should set the font for iTerm2 in Preferences(press + ,)

set font for powerline

4. Add Color Schemes

You can choose one of your favorite color scheme for the terminal here (Download it first).

Since I am using Atom for my text editor, I'd love Atom theme. Click Color Presets... > Import..., select one you like in iTerm2-Color-Schemes/schemes/**.itermcolors and click Color Presets... again to select it.

import color scheme

5. Install agnoster theme

$ git clone https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor.git
$ cd oh-my-zsh-agnoster-fcamblor/
$ ./install

And then you may configure it to add this theme.

$ vi ~/.zshrc

Modify the theme after ZSH_THEME to agnoster at 11th line:

modify theme

+ Q to quit your iterm and reopen it. You will see the amazing view.

theme set done

6. Install highlight plugin

$ cd ~/.oh-my-zsh/custom/plugins/
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
$ vi ~/.zshrc

Add zsh-syntax-highlighting to plugins(Make sure highlight plugin is the last one):

highlight plugin

This syntax will highlight the command you input to green if it is correct, otherwise red.

highlight plugin show

7. Install AutoSuggestion Plugin

$ cd ~/.oh-my-zsh/custom/plugins/
$ git clone https://github.com/zsh-users/zsh-autosuggestions
$ vi ~/.zshrc

Add zsh-autosuggestions to plugins next to git(Do not append it at the last line). Here is its functions:

auto suggestion plugin

8. Install powerlevel9k

Option1: Homebrew

$ brew tap sambadevi/powerlevel9k
$ brew install powerlevel9k

Option2: Git

$ git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k

Then set ZSH_THEME="powerlevel9k/powerlevel9k"in ~/.zshrc

You can see more info on wiki page. And there are lots of config templet here.

9. Install Hack Nerd Font

$ brew tap homebrew/cask-fonts
$ brew cask install font-hack-nerd-font

iterm_zsh_nerd_font

Last Modified: August 24, 2019
Archives Tip
QR Code for this page
Tipping QR Code
Leave a Comment

2 Comments
  1. Apollo Apollo

    看不懂,好像很厉害的样子~

    1. @Apollo🌚