git - oh-my-posh 提示中未呈现的字符

标签 git powershell powershell-core windows-terminal

<分区>

我刚刚在 Windows 上的 PowerShell Core 7.1.1 上安装了 oh-my-posh,我在 Windows 终端中使用 PowerShell。切换到git仓库后,提示如下: enter image description here 一些字符显示为框,应该是三角形和分支字符 enter image description here 我目前正在使用 Cascadia 字体,并尝试过 Meslo LG M Regular 和其他一些字体,但没有任何效果。

我也设置了编码为UTF-8,我可以在命令行中输入Unicode字符并且它们可以正确显示。

如何解决丢失的方框字体?

最佳答案

试试这个:

  • 如果您还没有更新 oh-my-posh 到版本 3:Update-Module -Name oh-my-posh -Scope CurrentUser
  • 从以下位置下载并安装 Caskaydia Cove Nerd Font 字体:https://www.nerdfonts.com/font-downloads
  • 在您的 PowerShell 配置文件 (Microsoft.PowerShell_profile.ps1) 中,设置一个类似这样的主题:Set-PoshPrompt Powerline(以前是 Set-Theme Powerline;您可以按 Tab 键在可用主题之间循环)
  • 在 Windows 终端设置中,像这样设置默认字体:
"profiles": {
        "defaults": {
            // Put settings here that you want to apply to all profiles.
            "fontFace": "CaskaydiaCove NF",
            "fontSize": 12
        },
}

关于git - oh-my-posh 提示中未呈现的字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66058894/

相关文章:

git - Travis-CI:将不同的分支部署到不同的服务器

Git merge 分支之间的提交

android - 如何在 CentOS 上运行 repo android?

powershell - 启动进程不适用于 VSIXInstaller.exe

powershell - 如何检查一个文件的存在

powershell - 我可以在Powershell中自定义 'not recognized as the name of a cmdlet'错误吗?

powershell - 本地 New-PSSession 在基于官方 powershell linux 的 docker 图像中失败

svn - 描述您使用版本控制(VCS 或 DVCS)的工作流程

c# - 将 Dictionary[String,String] 从 powershell 发送到 TextTransform.exe

powershell - 如何在 PowerShell 中隐藏 Get-Help 中的参数(不仅仅是制表符完成)?