Oh-My-Zsh 是一款增强终端软件,可以让你自定义主题和插件。有了它,终端使用体验会好很多。这里记一下安装方法。
- 安装 ZSH
BASH
sudo apt install zsh -y
- 安装 Oh-My-Zsh:
系统会提示你是否需要切换到 zsh,也可以自己用 chsh -s $(which zsh) 切换,然后用 echo $SHELL 确认当前使用的 shell(可能需要重新连接服务器)。
BASH
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
下载推荐的字体,点击安装,然后把终端字体设置为
MesloLGS NF:BASHwget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf && wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf && wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf && wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf删除已安装的字体,安装主题和插件:
Shell
# 删除已安装的字体
rm -rf MesloLGS*.ttf
# powerlevel10k
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
# 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
# 编辑 zshrc
vi ~/.zshrc
.ZSHRC
# 修改 zsh 的主题
ZSH_THEME="powerlevel10k/powerlevel10k"
# 启用插件
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
然后重新连接服务器,正常情况下会进入 Oh-My-Zsh 的配置界面。
祝你玩得开心