As a powerful terminal that every developer has, why wouldn’t you?

Without further ado, let’s get to installation.

Install the ZSH

Be sure to run ZSH –version first to check whether ZSH is installed.

Information similar to ZSH 5.7.1 is displayed indicating that you can skip ZSH and install iTerm2 directly.

macOS

The latest macOS comes with ZSH built in, so you probably won’t need to do this.

To install Homebrew, visit: brew.idayer.com/.

brew install zsh
Copy the code

Set to default:

chsh -s /usr/local/bin/zsh
Copy the code

For more details about how to install a platform, see Installing-zsh.

Install iTerm2

ITerm2 is a more powerful alternative to terminals on the macOS platform and currently supports macOS 10.14 and later.

You can download iTerm2 directly from the official website.

Set iTerm2 as the default

Find options: iTerm2 -> Make iTerm2 Default Term

Oh – my – ZSH installation

Select one of the following scripts to install:

Curl:

export REMOTE=https://gitee.com/imirror/ohmyzsh.git
sh -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ohmyzsh/ohmyzsh/tools/install.sh)"
Copy the code

Wget:

export REMOTE=https://gitee.com/imirror/ohmyzsh.git
sh -c "$(wget -O- https://cdn.jsdelivr.net/gh/ohmyzsh/ohmyzsh/tools/install.sh)"
Copy the code

Fetch:

export REMOTE=https://gitee.com/imirror/ohmyzsh.git
sh -c "$(fetch -o - https://cdn.jsdelivr.net/gh/ohmyzsh/ohmyzsh/tools/install.sh)"
Copy the code

Configure the topic

The official collection of themes (new themes are not included), you can visit the theme && Screenshots page to view and select.

Here, agnoster is used as an example.

1. Edit~/.zshrcFile, modifyZSH_THEMEConfiguration:

ZSH_THEME="agnoster"
#Theme introduction, please visit https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster
Copy the code

2. Install fonts

Agnoster also requires an additional installation of the font Meslo for Powerline

Most topics use Powerline Fonts

Download the TTF file and double-click to complete the installation.

3. Choose a font

Then open iTerm -> Preferences -> Profiles -> Text -> Change Font and select Meslo LG S Regular for Powerline.

Re-open iTerm2 to see the effect.

If you don’t find anything you like, try more.

You can also try Random, without deciding which theme to choose:

ZSH_THEME="random"
Copy the code

Specify participating random topics:

ZSH_THEME_RANDOM_CANDIDATES=(
  "robbyrussell"
  "agnoster"
)
Copy the code

Topics can also be excluded:

ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod)
Copy the code

enhancements

1. zsh-autosuggestions

Command automatic completion function.

1. Clone code to $ZSH_CUSTOM/plugins (default location ~/.oh-my-zsh/custom/plugins)

git clone https://gitee.com/imirror/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Copy the code

Finally, run the source ~/.zshrc command to take effect.

2. Enable the plugin in the Oh My Zsh configuration

Open ~/.zshrc, find plugins, and append zsh-autoSuggestions.

Git is the default configuration.

plugins=(git zsh-autosuggestions)
Copy the code

If you do not see autocomplete content, make sure that the following two colors are not similar:

iTerm > Preferences > Profiles > Colors > ANSI Colors > Bright > Black
iTerm > Preferences > Profiles > Colors > Basic Colors > Background
Copy the code

2. zsh-syntax-highlighting

Syntax highlighting.

1. Clone code to $ZSH_CUSTOM/plugins (default location ~/.oh-my-zsh/custom/plugins)

git clone https://gitee.com/imirror/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Copy the code

2. Enable the plugin in the Oh My Zsh configuration

Open ~/.zshrc, find plugins, and append zsh-autoSuggestions.

Git is the default configuration.

plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
Copy the code

Finally, run the source ~/.zshrc command to take effect.

Follow the public account: Lake Sword, find out more about me.