MacOS安装oh-my-zsh

1. oh-my-zsh安装

1.1. 使用curl方式安装

1.1.1 官方镜像源

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

1.1.2 国内Gitee加速源

sh -c "$(curl -fsSL https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh)"

1.2. 使用wget方式安装

1.2.1 官方镜像源

sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

1.2.2 国内Gitee加速源

sh -c "$(wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh -O -)"

2. Oh-my-zsh配置

2.1 主题配置

  • Oh-my-zsh路径为 ~/.oh-my-zsh/themes目录内,我比较喜欢robbyrussell
# 可在主题目录内查找自己喜欢的主题
ls ~/.oh-my-zsh/themes/
  • 修改~/.zshrc文件,将主题修改为robbyrussell
➜  ~ cat ~/.zshrc | grep ZSH_THEME
ZSH_THEME="robbyrussell"
# Setting this variable when ZSH_THEME=random will cause zsh to load
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
➜  ~
  • 如果你喜欢挑战,想尝试使用不同主题,可以考虑将主题设置成随机模式
ZSH_THEME="random"

2.2 插件配置

2.1 下载插件

2.1.1 自动补全插件

git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

2.1.2 语法高亮插件

git clone https://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

2.2 引入插件

  • 引入插件需要编辑~/.zshrc文件,在配置文件中找到plugins文件行,在其中添加内容,如下是修改完成后的配置
➜  ~ cat ~/.zshrc | grep plugins=
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
➜  ~
posted @ 2023-10-21 11:51  二乘八是十六  阅读(62)  评论(0编辑  收藏  举报