本文最后更新于 2025年4月5日 下午
安装zsh
1 2 3
| sudo apt install zsh zsh --version sudo chsh -s $(which zsh)
|
zsh
首次进入后,选择1
初始化配置文件,安装oh-my-zsh会覆盖此配置。
安装oh-my-zsh
1 2 3
| sh -c "$(curl -fsSL https://install.ohmyz.sh)" sh -c "$(wget -O- https://install.ohmyz.sh)" sh -c "$(fetch -o - https://install.ohmyz.sh)"
|
安装powerlevel10k主题
1 2 3 4
| git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k" git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
sed -i 's/^ZSH_THEME=.*/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc
|
修改zshrc,配置主题ZSH_THEME="powerlevel10k/powerlevel10k"
重新配置主题p10k configure
安装其他工具
1 2 3 4 5 6 7
| # 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 # zsh-z目录切换跳转 git clone https://github.com/agkozak/zsh-z $ZSH_CUSTOM/plugins/zsh-z
|
安装字体
- 安装MesloLGS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| # 下载字体 wget https://ghfast.top/https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf && wget https://ghfast.top/https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf && wget https://ghfast.top/https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf && wget https://ghfast.top/https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf
# 安装字体 sudo mkdir /usr/share/fonts/truetype/MesloLGS sudo mv *.ttf /usr/share/fonts/truetype/MesloLGS
# 安装fontconfig工具 sudo apt install fontconfig
# 刷新字体缓存 fc-cache -fv
# 测试字体显示 echo $'\uf115' # 能打印出文件夹图标则成功
|
- 安装powerline字体
1 2 3 4 5 6 7 8 9 10 11 12
| sudo apt install fonts-powerline
sudo dnf install powerline-fonts
# clone git clone https://github.com/powerline/fonts.git --depth=1 # install cd fonts ./install.sh # clean-up a bit cd .. rm -rf fonts
|
- 字体下载网站
应用主题和插件
1 2 3 4 5 6 7 8 9 10 11 12 13
| # 编辑配置文件,修改主题和插件 vim ~/.zshrc
# 修改主题 ZSH_THEME="powerlevel10k/powerlevel10k"
# 启用插件 plugins=( git zsh-autosuggestions zsh-syntax-highlighting z )
|
参考
- linux 终端美化