windows power shell 安装显示目录git扩展oh-my-posh
经验与学习 2024/11/22 0:28:08 点击:不统计
http://%77%77%77%2E%66%6F%72%61%73%70%2E%63%6E
windows安装 windows power shell 想在命令行显示当前目录和git 分支名称,并支持shell 命令,下面是oh-my-posh安装步骤:
1. 下载安装 oh-my-posh 安装后重启一下 windows power shell
winget install JanDeDobbeleer.OhMyPosh -s winget
2. 添加oh-my-posh环境变量,支持 oh-my-posh 命令
检查 系统环境是否自动安装成功
oh-my-posh --version # 如果显示版本则不用添加环境变量。
如果提示没有定义则找到 C:\Users\[当前用户名]\AppData\Local\Programs\oh-my-posh
添加到 系统环境变量
3. 下载 oh-my-posh 模板
mkdir ~/.poshthemes
oh-my-posh get shell
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\powerlevel10k_lean.omp.json" | Invoke-Expression
4. 应用模板
if (!(Test-Path -Path $PROFILE)) {
New-Item -Type File -Path $PROFILE -Force
}
5. 编辑启动时自动运行 oh-my-posh
notepad $PROFILE
输入
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\powerlevel10k_lean.omp.json" | Invoke-Expression
保存
6. 使配置生效
. $PROFILE
7. 重启windows power shell 试试即可。
·上一篇:nginx 配置conf直接返回测试nginx可用 >> ·下一篇:网站架构 >>