好的排版设计网站,网站 做实名认证吗,网站开发与服务合同,国内翻国外加速器#x1f9e9; 在 Ubuntu 下配置 oh-my-posh —— 普通用户 root 各自使用独立主题#xff08;共享可执行#xff09;✅ 目标说明普通用户 使用 tokyonight_storm 主题 root 用户 使用 1_shell 主题 共用全局路径下的 oh-my-posh 可执行文件 正确加载 Homebrew 到环境变量中… 在 Ubuntu 下配置 oh-my-posh —— 普通用户 root 各自使用独立主题共享可执行✅ 目标说明普通用户 使用 tokyonight_storm 主题 root 用户 使用 1_shell 主题 共用全局路径下的 oh-my-posh 可执行文件 正确加载 Homebrew 到环境变量中 分别加载独立的 .omp.json 配置 ✅安装流程1. 安装 Homebrew普通用户下
/bin/bash -c $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)️ 2. 将 Brew 加入环境变量写入 .bashrc
echo eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) ~/.bashrc
source ~/.bashrc如果你使用 zsh请改为 .zshrc3. Nerd Font 字体设置终端图标支持
Ubuntu 本地终端
mkdir -p ~/.local/share/fonts/NerdFonts
cd ~/.local/share/fonts/NerdFontswget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/FiraCode.zip
unzip FiraCode.zip
rm FiraCode.zipfc-cache -fvWSL2 设置方法打开 Windows Terminal → 选择配置的 profileAppearance外观 → Font → 设置为 FiraCode Nerd Font 等4. 安装 oh-my-posh
brew install jandedobbeleer/oh-my-posh/oh-my-posh如遇编译错误提示
sudo apt install clang5. 将 oh-my-posh 拷贝至全局路径
sudo cp $(which oh-my-posh) /usr/local/bin/
sudo chmod x /usr/local/bin/oh-my-posh6. 下载全部主题文件需先装 unzip
sudo apt install unzip -ymkdir -p ~/.poshthemes
cd ~/.poshthemescurl -fLo themes.zip https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip
unzip themes.zip
chmod 644 *.omp.json
rm themes.zip普通用户配置使用 tokyonight_storm编辑 ~/.bashrc
nano ~/.bashrc加入
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
eval $(oh-my-posh init bash --config ~/.poshthemes/tokyonight_storm.omp.json)保存并生效
source ~/.bashrcroot 用户配置使用 1_shell拷贝主题文件到 root
sudo mkdir -p /root/.poshthemes
sudo cp ~/.poshthemes/1_shell.omp.json /root/.poshthemes/
sudo chmod 644 /root/.poshthemes/1_shell.omp.json编辑 /root/.bashrc
sudo nano /root/.bashrc添加
eval $(oh-my-posh init bash --config /root/.poshthemes/1_shell.omp.json)保存并生效
sudo su
source ~/.bashrc✅ 总结配置表组件内容路径或值Brew环境变量加载/home/linuxbrew/.linuxbrew/bin/brew shellenvoh-my-posh全局可执行文件/usr/local/bin/oh-my-posh普通用户使用 tokyonight_storm 主题~/.poshthemes/tokyonight_storm.omp.jsonroot 用户使用 1_shell 主题/root/.poshthemes/1_shell.omp.json你现在已经完成了 oh-my-posh 的完整配置