说明 Oh My ZSH 官网
Unleash your terminal like never before.
Oh My Zsh is a delightful, open source, community-driven framework for managing your Zsh configuration. It comes bundled with thousands of helpful functions, helpers, plugins, themes, and a few things that make you shout…
1.Oh My Zsh安装
1.1. 安装Zsh
# 安装 Zsh,遇到 Y/N 选择 Y
sudo apt install zsh
# 将 Zsh 设置为默认 Shell
# 可以通过 echo $SHELL 查看当前默认的 Shell,如果没有改为 /bin/zsh,那么需要重启 Shell。
chsh -s /bin/zsh
1.2. 安装 Oh My Zsh
- Install oh-my-zsh via curl
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
- Install oh-my-zsh via wget
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
- 安装成功,配置文件在根目录下
.zshrc
,编辑vim ~/.zshrc
2. Oh My Zsh 插件配置
2.1. zsh-autosuggestions
- 说明:命令行命令键入时的历史命令建议插件,自动补全。
- 安装:
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- 配置:打开配置文件
vim ~/.zshrc
,找到plugins
,在里面添加zsh-autosuggestions
,重置source ~/.zshrc
。
2.2. zsh-syntax-highlighting
- 说明:命令行语法高亮插件
- 安装:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
- 配置:打开配置文件
vim ~/.zshrc
,找到plugins
,在里面添加zsh-syntax-highlighting
(这个要放到最后),重置source ~/.zshrc
。
2.3. .zshrc
文件整体修改
- 打开编辑
.zshrc
文件,找到plugins
,进行修改:
- 保存、退出、重置
source ~/.zshrc