使用iTerm2和oh-my-zsh美化Mac终端
最终效果图:
需要安装的清单有:
- iTerm2
- iTerm2的主题:Dracula
- Oh my zsh
- ohmyzsh主题:Spaceship
- Powerline fonts字体
- 一些插件和壁纸
安装过程
- 安装iTerm2,然后依次打开 Preferences-Appearance-General-Theme,选择Minimal。
- 下载安装Dracula主题
1 | git clone https://github.com/dracula/iterm.git |
然后按照官网描述的步骤安装即可,完成后:
设置背景图片,依次打开iTerm2-Preferences-Profiles-windows-Background Image,选择enable,然后选择自己喜欢的图片,我选择的是漫画《鬼刀》里的一张高清图片,设置图片的背景透明度可以拖动Blending旁边的滑动条实现。图片资源地址点击这里。
设置显示信息。依次打开iTerm2-Preferences–Session,勾选Status bar enable,Configure Status Bar,把上面的一些功能拖动到下面的框框里即可。我选择了当前文件夹,网速和搜索。打开Preferences-Window-Window custom title,填入想要的标题,我填的是iMac。
将默认shell设为zsh,
1
2
3chsh -s /bin/zsh
echo $SHELL
输出 /bin/zsh然后安装oh my zsh,
1
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
安装Spaceship 主题,首先按照官网给的步骤下载:
1
2
3git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt"
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"然后打开
~/.zshrc
,将ZSH_THEME修改为ZSH_THEME="spaceship"
。最后source ~/.zshrc
重新加载配置文件。下载Powerline fonts:
1
2
3
4
5
6
7
8clone
git clone https://github.com/powerline/fonts.git --depth=1
install
cd fonts
./install.sh
clean-up a bit
cd ..
rm -rf fonts设置字体,依次打开iTerm2-Preferences-Text-Font,我选择的是Fira Mono for Powerline字体。
安装插件zsh-syntax-highlighting和zsh-autosuggestions:
1
2
3git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting然后在
~/.zshrc
中,添加插件:1
2# Add wisely, as too many plugins slow down shell startup.
plugins=(git z osx extract zsh-syntax-highlighting zsh-autosuggestions)其中,z,osx,extract是oh-my-zsh自带的插件,可以选择添加。添加完成后,再次执行
source ~/.zshrc
至此,美化过程结束。