文章目录
- 1 下载并安装iTerm2
- 2 安装solarized主题
- 3 安装oh-my-zsh并配置agnoster主题
- 4 设置powerline
- 5 隐藏用户名信息
- 6 设置语法高亮和代码自动补全
- 7 (可选)如果出现plugin ‘zsh-autosuggestions’ not found
1 下载并安装iTerm2
brew install iterm2
安装成功后
brew -v
2 安装solarized主题
-
下载安装包
git clone https://github.com/altercation/solarized.git
-
安装
下载解压Solarized Dark,点击目录solarized\iterm2-colors-solarized的Solarized Dark.itermcolors和 Solarized Light.itermcolors进行安装。 -
iterm2的settings中设置
3 安装oh-my-zsh并配置agnoster主题
- 从github中下载
“使用 Homebrew 完成 zsh 和 zsh completions 的安装”
brew install zsh zsh-completions
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
- 修改主题
vim ~/.zshrc //进入.zshrc文件,将ZSH_THEME后面字段改为agnoster
4 设置powerline
iterm2勾选上
5 隐藏用户名信息
一般终端每一行前都会有xxx@xxxdeMacbook-Pro:我们可以将其隐藏掉。
进入oh-my-zsh的agnoster主题,编辑agnoster.zsh-theme文件:
vim ~/.oh-my-zsh/themes/agnoster.zsh-theme
注释掉这一行,效果如下
6 设置语法高亮和代码自动补全
在oh-my-zsh存储库中克隆存储库:
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
在.zshrc中插入下面内容:
plugins=(
git
zsh-completions
)
autoload -U compinit && compinit
直接使用homebrew安装zsh-syntax-highlighting插件
brew install zsh-syntax-highlighting
然后在根目录下.zshrc中插入下面内容:
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
在.zshrc中插入下面内容:
plugins=(
git
zsh-completions
zsh-syntax-highlighting
)
zsh-autosuggestions:补全的是历史输入的命令,点击方向键->即可补全
brew install zsh-autosuggestions
在.zshrc中插入下面内容:
plugins=(
git
zsh-completions
zsh-autosuggestions
zsh-syntax-highlighting
)
7 (可选)如果出现plugin ‘zsh-autosuggestions’ not found
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
source ~/.zshrc