Mac下配置ZSH

先来看一下效果, 容许我用一下官方图片node

Paste_Image.png

1. 什么是zsh, oh-my-zsh

zsh是Z Shell, 功能很强大可是太复杂,因此就出现了优化版的oh-my-zshgit

2. 检查zsh

zsh --version;

若是存在, 则说明已安装, 直接跳过本步骤 (mac 自带Z Shell)github

curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh

3. 安装oh-my-zsh

curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh

若是遇到问题, 能够直接copy上面的sh文件, 而后download, 本地执行sh命令npm

4. 安装iterm2

更强大的终端工具, 替换系统terminal, 与oh-my-zsh配合起来使用更完美
具体功能能够访问iterm2官网bash

5. 字体安装

为了不有些oh-my-zsh主题的字体乱码问题, 最好设置iterm2的font为powerline类的字体, 本身search一下
字体传送门, 按README进行下载安装.
Paste_Image.pngcurl

clipboard.png

6. oh-my-zsh主题修改

修改 ~/.zshrc 下的 ZSH_THEME 字段, 如ZSH_THEME="agnoster", 流行主题之一. 主题库传送门.工具

7. oh-my-zsh插件

插件安装, 目录到入~/.oh-my-zsh/plugins字体

# zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/plugins/zsh-autosuggestions

# zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting

修改 ~/.zshrc 下的plugins字段, 如优化

plugins=(git homebrew node npm zsh-autosuggestions zsh-syntax-highlighting)

更多插件去google搜插件名安装google

8. 兼容.bash_profile

zsh安装后, .bash_profile下设置的环境变量和alias会失效, 须要在~/.zshrc文件里添加以下:

source .bash_profile

9. 切换默认终端

chsh -s /bin/zsh

切回bash能够用

chsh -s /bin/bash
相关文章
相关标签/搜索