打造 Mac 完美舒适终端

519 阅读1分钟

前言

每每拿到一台新电脑,让人最头疼的事情莫过于安装一大堆软件,还要配置一堆环境,一个小小的终端也要配置半天;为了减少去网上到处去搜索各种各样的配置,这里记录一下终端美化的一个解决方案

主流工具

iterm2 + on my zsh + 语法高亮 + 代码补全

下载 iterm2

iterm官网

https://iterm2.com/

安装 on my zsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

若出现超时问题,使用代理解决

选择主题

https://github.com/ohmyzsh/ohmyzsh/wiki/Themes

打开用户目录下~/.zhsrc,把ZSH_THEME修改为amuse,保存。

修改背景

image.png

下载字体

git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh

选择字体

image.png

插件安装

语法高亮&自动补全

语法高亮
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

自动补全
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

安装完后配置到 .zshrc文件中

image.png

问题修复

  1. brew install 出现 not a git directory
解决方案:终端 brew -v; 然后根据提示进行git配置

最终效果

image.png