由于配置了两台新的 Ubuntu 系统虚拟机,期望后续进行一些操作的时候更加方便,于是决定配置一下 ohmyzsh 终端。
我的系统环境:
Windows11 + VMware17 + Ubuntu24 + XShell8 + MesloLGS(字体)
字体下载地址:https://github.com/romkatv/dotfiles-public/tree/master/.local/share/fonts/NerdFonts
注意点:XShell 需要将终端设置为:xterm-256color
,如下图所示:
安装 Zsh
sudo apt update
sudo apt install zsh
安装 Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 确认安装成功
echo $SHELL
配置常用的插件
vim ~/.zshrc
# 找到 plugins=() 这一行,添加你需要的插件
plugins=(git zsh-autosuggestions zsh-syntax-highlighting autojump)
常见插件说明:
- git:提供 Git 命令的增强功能,如快捷命令提示。
- zsh-autosuggestions:提供命令自动补全建议。
- zsh-syntax-highlighting:为 Zsh 命令添加语法高亮显示。
- autojump:快速跳转到你经常访问的目录。
安装插件
安装 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
安装 autojump
sudo apt install autojump
重新加载配置
source ~/.zshrc
可选:安装 Powerlevel10k 主题(推荐,因为颜值是第一生产力)
Powerlevel10k 是一个非常流行且高度可定制的主题,提供更美观的提示符。可以按如下步骤安装:
# 克隆 Powerlevel10k 仓库
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
# 配置 .zshrc 使用 Powerlevel10k 主题
ZSH_THEME="powerlevel10k/powerlevel10k"
# 重新加载配置
source ~/.zshrc
首次加载时,Powerlevel10k 会引导你完成一些配置,选择你喜欢的外观。
重新配置p10k
通过 p10k configure
命令启动 Powerlevel10k 的配置向导进行重新配置。
评论区