1、安装iTerm2
将iTem2设置为默认终端:
(菜单栏)iTerm2 -> Make iTerm2 Default Term
然后打开偏好设置preference
,选中Keys
,勾选Hotkey
下的Show/hide iTerm2 with a system-wide hotkey
,将热键设置为command+.
,这样你就可以通过command+.
全局热键来打开或关闭iTerm2窗口,非常方便。
2、安装oh-my-zsh
,参照官网方法:
curl -L http://install.ohmyz.sh | sh
#或者
wget --no-check-certificate http://install.ohmyz.sh -O - | sh
3、安装一个字体库(有些皮肤需要)
# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts
修改字体:Preferences->Profiles->Text->Change Font->
选择一个字体,例如:Meslo LG M for Powerline
4、安装一个配色:
下载配色:https://draculatheme.com/iterm/
git clone https://github.com/dracula/iterm.git
5、配置zsh皮肤
vim ~/.zshrc
ZSH_THEME="agnoster"
#推荐的一个皮肤:powerlevel9k
#下载
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
#设置主题
ZSH_THEME="powerlevel9k/powerlevel9k"
# command line 左边显示的内容
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs)
# command line 右边显示的内容
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(time)
#还有很多设置访问:https://github.com/bhilburn/powerlevel9k#available-prompt-segments
6、启用ZSH
#查看当前默认Shell
echo $0
#查看机器上支持哪些shell
cat /etc/shells
#切换到zsh:
chsh -s /bin/zsh
7、安装自动提示插件:
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
#打开.zshrc默认是 plugins=(git) ,我们把它修改为
plugins=(zsh-autosuggestions git)
#可以修改提示字体颜色
cd ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
vim zsh-autosuggestions.zsh
#修改 ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=6'
8、使用homebrew安装 zsh-syntax-highlighting 插件
brew install zsh-syntax-highlighting
#在.zshrc中添加
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
备注:升级ZSH
upgrade_oh_my_zsh