最终效果图:
安装 iTerm2
直接去官网下载安装
美化 iTerm2
下载配色
iTerm2 自带配色不好看,好在可以导入第三方配色
GitHub原仓库下载太慢了,这里用 Gitee 备份
git clone https://gitee.com/ncfun/iTerm2-Color-Schemes
使用配色
Preferences->Profiles->colors->右下角Color Preset…
选择下载的配色,在 schemes
文件夹中,我使用 3204 Night
安装 Oh my zsh
终端切换为 zsh
chsh -s /bin/zsh
安装
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
如果遇到拒绝访问,可以这样解决
美化 Oh my zsh
下载第三方主题
GitHub原仓库下载太慢了,这里用 Gitee 备份
git clone https://gitee.com/ncfun/powerlevel10k
mv -f powerlevel10k ~/.oh-my-zsh/custom/themes/
修改.zshrc
,指定主题
ZSH_THEME="powerlevel10k/powerlevel10k"
重启 iTerm2,powerlevel10k 主题会有一个初始设置过程,根据提示选择自己喜欢的样式
也可以使用p10k configure
重新设定。
配置 Oh my zsh
在.zshrc
中配置自己需要的插件,仅在这里添加插件是不起作用的,还要下载插件到指定目录才行。
vim ~/.zshrc
# 在plugins后括号里添加安装的插件名字
plugins=(git autojump zsh-autosuggestions zsh-syntax-highlighting)
语法高亮插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
自动补全插件
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
目录跳转插件
git clone git://github.com/joelthelion/autojump.git
cd autojump
./install.py
根据安装完成后的提示,在~/.zshrc
最后添加提示的语句
让配置生效
重启终端或者source ~/.zshrc