iterm2 + oh my zsh + firacode字体 + Powerline字体 + snazzy主题 / agnoster主题 + pure prompt
插件:zsh-autosuggestions + zsh-syntax-highlighting
一、iTerm2
1、iTerm2 -> Make iTerm2 Default Term
2、配色
https://github.com/mbadolato/iTerm2-Color-Schemes
https://github.com/altercation/solarized
选用 solarized,下载解压,然后打开 iTerm2 下的偏好设置 preference ,点开 profiles 下的colors 选项,点击右下角的 Color Presets 选项,选择import ,导入解压到的 solarized 文件下的Solarized Dark.itermcolors
二、安装oh-my-zsh
安装oh-my-zsh成功后
- 用 vim 编辑隐藏文件 .zshrc, 终端输入
vi ~/.zshrc
ZSH_THEME="agnoster"
将zsh主题修改为“agnoster”
在开头添加一下配置
export PATH=PATH
sourceHOME/.bash_profile
应用“agnoster”主题需要特殊的字体支持,否则会出现乱码情况,
firacode字体
https://github.com/tonsky/FiraCode/wiki/Installing
Powerline字体
https://github.com/powerline/powerline
-
重新打开iTerm2窗口(或新打开一个iTerm2窗口)即可以看到字体效果
image.png
三、插件
zsh-autosuggestions: ctrl + (自动提示与命令补全
https://github.com/zsh-users/zsh-autosuggestions
PS:当你重新打开终端时可能看不到变化,可能你的字体颜色太淡了,我们把其改亮一些:
cd ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
用 vim 编辑 zsh-autosuggestions.zsh 文件,修改ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10'zsh-syntax-highlighting 语法高亮效果
https://github.com/zsh-users/zsh-syntax-highlighting
附:
- Mac 错误提示:zsh: command not found: brew解决方法
https://brew.sh/
- iTerm2 默认使用dash改用zsh解决方法:chsh -s /bin/zsh
- iTerm2 zsh切换回原来的dash:chsh -s /bin/bash
- 卸载oh my zsh,在命令行输入:uninstall_oh_my_zsh
- 路径前缀的XX@XX太长,缩短问题:
编辑~/.oh-my-zsh/themes/agnoster.zsh-theme主体文件,将里面的build_prompt下的prompt_context字段在前面加#注释掉即可