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 --version
a check to see if it is installed first zsh
.
Returns zsh 5.7.1
something like this stating that zsh
direct installation can be skipped iTerm2
.
macOS
macOS
Most recent systems have it built in zsh
, so you probably don't need to do this step.
The installation Homebrew
can 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
iTerm2
It is macOS
an alternative to the terminal on the platform, with more powerful functions, and currently supports macOS 10.14
and 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 agnoster
an example.
1. Edit ~/.zshrc
the file and modify ZSH_THEME
the configuration:
ZSH_THEME="agnoster"
# 主题介绍请访问 https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster
2. Install fonts
agnoster
You also need to install the font Meslo for Powerline[4]
Most of the themes use Powerline Fonts[5]
After downloading ttf
the 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 iTerm2
to see the effect.
agnoster-theme
If you don't find a satisfactory theme, you can try more themes[6] .
You can also try it random
without 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 ~/.zshrc
effect.
2. Oh My Zsh
Enable the plugin in the configuration
Open ~/.zshrc
, find plugins
, append zsh-autosuggestions
.
git
is 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 Zsh
Enable the plugin in the configuration
Open ~/.zshrc
, find plugins
, append zsh-autosuggestions
.
git
is the default configuration.
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
The last execution takes source ~/.zshrc
effect.