Beautify your terminal tool Iterm2

Iterm2 is a particularly easy-to-use terminal that supports custom fonts and highlighting, making daily development full of pleasure.

Install iterm2 (mac version)

brew tap caskroom/cask
brew cask install iterm2 # 或者去网站下载安装包

Preference configuration

Set 256 colors

# report terminal type: xterm-256color
iTerm2 -> Preferences -> Profiles -> Terminal

Configure high-value color

mkdir ~/.iterm2 && cd ~/.iterm2
git clone https://github.com/mbadolato/iTerm2-Color-Schemes

# 导入颜色 import...
iTerm2 -> Preferences -> Profiles -> colors
# 选择iTerm2-Color-Schemes下的schemes目录下所有文件

Install fonts

Install open source fonts

brew tap caskroom/fonts
brew cask install font-hack-nerd-font
# 若安装失败,则可能是被墙了,需要加代理

Configure iterm2

# iTerm2 -> Preferences -> Profiles -> Text -> Font下
# 勾选 Use a different font for non-ASCII text
# 配置字体为 Hack Nerd font

Install zsh

brew install zsh
# 默认的shell是bash,需要改为zsh
sudo sh -c "echo $(which zsh) >> /etc/shells"
chsh -s $(which zsh)
# 安装oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Configure theme

# 下载高颜值主题
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
# 配置 ZSH_THEME="powerlevel9k/powerlevel9k"
vim ~/.zshrc
# 应用生效
source ~/.zshrc

Other configuration

vim ~/.zshrc

POWERLEVEL9K_MODE="nerdfont-complete"
# Customise the Powerlevel9k prompts
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh dir vcs newline status)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true

Plugin recommendation

car dump

# 安装插件
brew install autojump
# 配置 .zshrc
vim ~/.zshrc
# 添加 plugins = (git autojump)
# 并在.zshrc文件中添加如下一行
# [[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.sh
# 应用生效
source ~/.zshrc

zsh-autosuggestions

# 安装插件
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
# 配置 .zshrc
vim ~/.zshrc
# 添加 plugins = (git zsh-autosuggestions)
# 应用生效
source ~/.zshrc

zsh-syntax-highlighting

# 安装插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# 配置 .zshrc
vim ~/.zshrc
# 添加 plugins = (git zsh-syntax-highlighting)
# 应用生效
source ~/.zshrc

Renderings

Iterm2 interface

Common shortcut keys

# 移动到行首
Ctrl + a

# 移动到行末
Ctrl + e

# 删除到行首
Ctrl + u

# 删除到行末
Ctrl + k

# 上一条命令
Ctrl + p

# 历史命令
Ctrl + r

Guess you like

Origin www.cnblogs.com/CocoML/p/12727132.html