1 配置ohmyzsh

如果非root用户,自行加sudo;自行解决访问github的问题 (export http_proxy='http://127.0.0.1:10808' && export https_proxy='http://127.0.0.1:10808')

1.1 安装基本工具

apt update && apt install -y zsh git curl

1.2 一键安装脚本

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

1.3 下载两个常用插件

# 下载高亮插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# 下载历史建议补全插件
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

1.4 主题改为agnoster(可选)

theme='agnoster'; file="$HOME/.zshrc"; awk -v theme="$theme" 'BEGIN{done=0} /^[[:space:]]*#/ {print; next} /^[[:space:]]*ZSH_THEME[[:space:]]*=/ {if(!done){print "ZSH_THEME=\"" theme "\""; done=1} next} {print} END{if(!done) print "ZSH_THEME=\"" theme "\""}' "$file" > "$file.tmp" && mv "$file.tmp" "$file"

1.5 启用插件

awk -i inplace '/^[[:space:]]*plugins=\(/ {
    sub(/^[[:space:]]*plugins=\(/, ""); sub(/\)[[:space:]]*$/, "");
    $0 = $0 " zsh-syntax-highlighting zsh-autosuggestions";
    out = "";
    for (i = 1; i <= NF; i++) {
        if (!seen[$i]++) out = (out ? out " " : "") $i;
    }
    print "plugins=(" out ")";
    next
} { print }' ~/.zshrc && source ~/.zshrc

2 解决字体显示问题

powershell中运行

winget install --id DEVCOM.JetBrainsMonoNerdFont --exact --silent --accept-package-agreements --accept-source-agreements

2.1 随后在设置中选中该字体即可

2026-09-05T10:59:20.png

2.2 成功效果

2026-09-05T11:00:13.png

2.3 未修复前效果

2026-09-05T11:00:40.png

最后修改:2026 年 09 月 05 日
如果觉得我的文章对你有用,请随意赞赏