iTerm2 + Oh My Zsh terminal installation tutorial for mac

As a powerful terminal for every developer, why don't you use it?

Not much nonsense, let's start the installation directly.

install zsh

Be sure to perform zsh --versiona check to see if it is installed first zsh.

Returns zsh 5.7.1something like this stating that zshdirect installation can be skipped iTerm2.

macOS

macOSMost recent systems have it built in zsh, so you probably don't need to do this step.

The installation Homebrewcan be accessed at: https://brew.idayer.com/ to teach you how to install quickly Homebrew.

brew install zsh

Set as default:

chsh -s /usr/local/bin/zsh

For more platform installation methods, please visit Installing-ZSH[1].

Install iTerm2

iTerm2It is macOSan alternative to the terminal on the platform, with more powerful functions, and currently supports macOS 10.14and higher versions.

You can download it directly from the official website [2] iTerm2.

Set iTerm2 as default

Find options:iTerm2 -> Make ITerm2 Default Term

Install oh-my-zsh

Choose one of the following script installations:

curl:

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

wget:

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

fetch:

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

configure themes

Official collection of some themes (new themes are no longer included), you can visit the theme&&screenshot[3] page to view and select.

Here is agnosteran example.

1. Edit ~/.zshrcthe file and modify ZSH_THEMEthe configuration:

ZSH_THEME="agnoster"
# 主题介绍请访问 https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster

2. Install fonts

agnosterYou also need to install the font Meslo for Powerline[4]

Most of the themes use Powerline Fonts[5]

After downloading ttfthe file, double-click to complete the installation.

3. Choose font

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

Re-open iTerm2to see the effect.

agnoster-theme

If you don't find a satisfactory theme, you can try more themes[6] .

You can also try it randomwithout worrying about which theme to choose:

ZSH_THEME="random"

Designate subjects for random participation:

ZSH_THEME_RANDOM_CANDIDATES=(
  "robbyrussell"
  "agnoster"
)

It is also possible to exclude topics:

ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod)

function enhancement

1.zsh-autosuggestions

Command auto-completion.

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

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

The last execution takes source ~/.zshrceffect.

2. Oh My ZshEnable the plugin in the configuration

Open ~/.zshrc, find plugins, append zsh-autosuggestions.

gitis the default configuration.

plugins=(git zsh-autosuggestions)

If you can't see the auto-completion content, make sure the following two colors are not similar:

iTerm > Preferences > Profiles > Colors > ANSI Colors > Bright > Black
iTerm > Preferences > Profiles > Colors > Basic Colors > Background

2. zsh-syntax-highlighting

Syntax highlighting.

1. Clone the code to $ZSH_CUSTOM/plugins(by default ~/.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

2. Oh My ZshEnable the plugin in the configuration

Open ~/.zshrc, find plugins, append zsh-autosuggestions.

gitis the default configuration.

plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

The last execution takes source ~/.zshrceffect.

Guess you like

Origin blog.csdn.net/hebiwen95/article/details/126489505