zsh配置
1、zsh
1.1 检查是否已安装 Zsh
zsh --version
- 如果输出类似
zsh 5.8,说明已安装。 - 如果提示
command not found,则需要安装。
1.2 Debian/Ubuntu 及衍生版(如 Linux Mint)
sudo apt update
sudo apt install zsh
1.3 RHEL/CentOS/Rocky Linux/AlmaLinux
# CentOS 7 / RHEL 7
sudo yum install zsh
# CentOS 8+ / Rocky Linux 8+
sudo dnf install zsh
1.4 将 Zsh 设为默认 Shell
# 查看 Zsh 安装路径
which zsh
# 通常输出:/bin/zsh 或 /usr/bin/zsh 或 /opt/homebrew/bin/zsh
# 将其加入合法 Shell 列表(某些系统需要)
echo $(which zsh) | sudo tee -a /etc/shells
# 设为当前用户的默认 Shell
chsh -s $(which zsh)
1.5 (可选)安装 Oh My Zsh —— 让 Zsh 更强大!
安装命令(一键安装):
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
- 备份原有
.zshrc - 创建新的配置文件
- 启用默认主题(robbyrussell)
1.6 两个常用插件安装
zsh-autosuggestions安装 # 输入建议
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
zsh-syntax-highlighting 语法高量
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
cd ~
vim .zshrc
#最后面把plugins=(git)修改如下
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
主题
ZSH_THEME="itchy"

浙公网安备 33010602011771号