为 Mac M1 安装并配置 oh-my-zsh
- m1 芯片的全新 Mac 电脑使用 /bin/zsh 作为默认的 shell,因此不需要再安装 zsh
- 可以在终端下使用
echo $SHELL
命令来查看当前的 shell- 若要更换 shell,使用
chsh -s /bin/bash
命令
安装 oh-my-zsh
由于国内 raw.githubusercontent.com 经常无法访问,所以我们在 gitee 上面寻找镜像项目,即运行如下代码安装 oh-my-zsh:
sh -c "$(wget -O- https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh)"
安装完成后,终端直接自动使用 oh-my-zsh
安装 oh-my-zsh 插件
目前我额外安装的插件有:
- zsh-autosuggestions
- zsh-syntax-highlighting
从互联网下载这些插件,使用的命令分别为:
1. git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
2. git clone git://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
修改 ~/.zshrc 文件,在插件列表中填入插件名称,如下所示:
74 # Add wisely, as too many plugins slow down shell startup.
75 plugins=(
76 git
77 zsh-autosuggestions
78 zsh-syntax-highlighting
79 )
重新加载 ~/.zshrc 文件
source ~/.zshrc
我喜欢的 oh-my-zsh 主题
12 # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
13 ZSH_THEME="ys"