iTerm2 安装与配置
iTerm2 安装
推荐使用Homebrew
,简单方便
brew cask install iterm2
也可以前往官网下载,解压后拖入Applications
中
Oh My Zsh 安装
先查看系统支持的shell
cat /etc/shells
如果没有/bin/zsh
,就安装zsh
brew install zsh
将zsh
设置为默认shell
chsh -s /bin/zsh
#查看当前使用的shell
echo $shell
可以直接输入bash
,zsh
等直接切换
最后安装oh my zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
到此终端已经可以进行一些命令补全了
iterm2 主题
去下载对应的主题,文件后缀为.itemcolors
我使用的如下
打开iterm2的设置 进入Profiles -> Colors -> Color Presets -> Import
选择下载的主题文件,选好主题保存设置
zsh 主题安装
编辑.zshrc
文件
vim ~/.zshrc
#光标移动到ZSH_THEME="XXX"一行
cc
ZSH_THEME="agnoster"
#按Esc 退出到普通模式
:wq #保存退出
agnoster
还需要支持powerline的字体,下载Meslo for PowerLine 并安装
Meslo LG M Regular for Powerline.ttf
安装完成后再次打开iterm设置,进去Profiles -> Text -> Font -> Change Font
选择对应字体
最终效果如下
安装插件
自动补全
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
vim ~/.zshrc
#Command + F 查找plugins
#找到 plugins = (git)一栏,改为
plugins=(git zsh-autosuggestions)
Esc :wq #保存退出
语法高亮
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
vim ~/.zshrc
# 在文章末尾添加
source "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"