没有花里胡哨的操作,跟着敲就可以完成。
- 安装 iTerm (官网直接下载)
- 安装成功之后,最顶部工具栏选择 iTerm2 -> Preferences -> Profiles -> Color 选择好喜欢的主题,后续配合下面讲述到的 oh-my-zsh
- iTerm2 -> Preferences -> Profiles -> Text 选择 Powerline 字体,记得勾选“Use a different font for non-ASCII text” 上下两块选择同样字体 (下面会讲到)
// 方法一 (只需要一行代码)
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
// 方法二 (两个 git 地址二选一即可,看个人网络情况)
git clone https://gitee.com/jklash1996/ohmyzsh.git
git clone https://github.com/ohmyzsh/ohmyzsh.git
// 1. 拉取项目之后,cd 到项目中 tools 文件夹中执行 install.sh 文件
cd ohmyzsh/tools
./install.sh
// 2. 上述指令执行完会安装好.oh-my-zsh 和 .zshrc 在你电脑的根目录下
sudo vi ~/.zshrc
// 3. 在文件中找到变量 ZSH_THEME 设置为 agnoster
ZSH_THEME="agnoster"
// 4. 完成上述步骤就可以使用了,但是有可能有字体乱码的问题。需要安装 Powerline fonts
git clone https://gitee.com/zhoutotong/powerline-fonts.git
git chone https://github.com/powerline/fonts.git
// 5. 一样二选一拉取项目之后,cd 到项目根目录下执行 install.sh 文件
./install.sh
// 6. 安装完成之后在最开始的 iTerm2 -> Preferences -> Profiles -> Text 中选择
// Meslo LG S for Powerline 字体。这样就大功告成了。
// 7. 如果需要插件的话,继续往下看。
// 语法高亮插件 -> zsh-syntax-highlighting
// 代码补全插件 -> zsh-autosuggestions
brew install zsh-syntax-highlighting
brew install zsh-autosuggestions
// 8. 安装完成之后,执行 步骤2 修改 .zshrc 文件,找到 plugins 字段,添加所需插件。
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
plugins = {
zsh-syntax-highlighting
zsh-autosuggestions
}
ps:还没有安装 brew 的 点这里