微信公众号:乌鸦安全
1. 安装iterm2
https://zhuanlan.zhihu.com/p/37195261
https://iterm2.com/downloads.html

下载之后,对iTerm.app文件右键打开(有些时候,如果不是右键打开的话,可能会报当前文件危险,禁止打开):
 
将程序移动到应用程序文件夹之后,直接打开:
 
 此时,iterm2已经安装完成了。
 
 在这里配置设置为默认终端。
但是这个终端到我们的需求还差好多,界面看上去好丑。。。
2. 安装Zsh
直接在命令行里面输入这个语句:
 sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

 因为网络的问题,所以在这里使用的是系统的命令加速,访问了github下载了Zsh
 下载之后,重启iterm2:
 
此时iterm生效。
3. 优化iterm
在命令行中,使用vim ~/.zshrc打开隐藏文件,修改主题为agnoster
 
修改之后:使用命令source ~/.zshrc,但是发现此时的字体存在乱码。
 
 修改乱码需要加入字体:
 [https://github.com/powerline/fonts/blob/master/Meslo%20Slashed/Meslo%20LG%20M%20Regular%20for%20Powerline.ttf](https://github.com/powerline/fonts/blob/master/Meslo%20Slashed/Meslo%20LG%20M%20Regular%20for%20Powerline.ttf)
 
 双节打开,安装字体:
 
打开preferences看到当前的原始数据:
 
 在Text中,选择刚安装的字体和修改字体大小:
 
设置闪符

 在这里可以选择配色,但是官方带的配色有限,可以从网上直接下载:
 [https://iterm2colorschemes.com/](https://iterm2colorschemes.com/)


 在这里选择import导入:
 
 在这里找到刚下载的数据,选择schemes:

 打开之后,全选导入:
 
打扰iterm2之后,在这里就有所有的配色方案了:
 
我现在选择的是Dracula:
 
 当然,有很多的都可以选择:
4. 代码高亮
cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
vi ~/.zshrc
 

 在这里先不使用加载,等命令补全之后再一起加载。
5. 命令补全
cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-autosuggestions
vi ~/.zshrc
 

 找到plugins,把这个插件添加上:
plugins=(
    git
    zsh-autosuggestions
    zsh-syntax-highlighting
)
    
 
修改前:
 
 修改后:

重新加载,使用命令source ~/.zshrc

 此时已经生效:
 










