简体   繁体   English

如何从我的 oh-my-posh/posh-git 显示中删除红色基础字形?

[英]How to remove red base glyph from my oh-my-posh/posh-git display?

I'm using windows terminal v1.0.1402.0 with powershell v7.0.1 with oh-my-posh and posh-git.我将 windows 终端 v1.0.1402.0 与 powershell v7.0.1 与 oh-my-posh 和 posh-git 一起使用。 I'm currently getting the following red base glyph when I open up my terminal.当我打开终端时,我目前正在获得以下红色基础字形。

红色字形错误

I've installed and tried using MesloLGL NF and Cascadia Mono PL for the fonts which both should work with oh-my-posh.我已经为 fonts 安装并尝试使用 MesloLGL NF 和 Cascadia Mono PL,它们都应该与 oh-my-posh 一起使用。

Here is my powershell profile:这是我的 powershell 个人资料:

Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Paradox

Here is my windows terminal settings这是我的 windows 终端设置

 "defaults":
        {
            "colorScheme":  "One Half Dark",
            //"fontFace": "MesloLGL NF"
            "fontFace": "Cascadia Mono PL"
            // Put settings here that you want to apply to all profiles.
        },
        "list":
        [   
            {
                // Make changes here to the powershell.exe profile
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "pwsh.exe",
                "useAcrylic": true,
                "acrylicOpacity": 0.8,
                "hidden": false
            },

I get this error regardless of what directory I'm in.无论我在哪个目录中,我都会收到此错误。

If it helps, here are my theme settings too: (Side note: The error count just went to 1, when I printed this before it was still 0)如果它有帮助,这也是我的主题设置:(旁注:错误计数刚刚达到 1,当我在它仍然为 0 之前打印它时)

PromptSymbols        : {SegmentBackwardSymbol, RootSymbol, PromptIndicator, VirtualEnvSymbol...}
CurrentHostname      : MyHost
MyThemesLocation     : C:\MyPath\PowerShell\PoshThemes
CurrentThemeLocation : C:\MyPath\PowerShell\Modules\oh-my-posh\2.0.412\Themes\Paradox.psm1
GitSymbols           : {BeforeIndexSymbol, LocalStagedStatusSymbol, DelimSymbol, BranchUntrackedSymbol...¦}
Options              : {ConsoleTitle, OriginSymbols}
ErrorCount           : 1
CurrentUser          : user
Colors               : {GitForegroundColor, GitDefaultColor, PromptForegroundColor, VirtualEnvBackgroundColor...¦}

To those who encounter this behaviour and do not want to fully remove the oh-my-posh integration with conda like the accepted answer says, there is one way of fixing the unknown glyph.对于那些遇到这种行为并且不想像公认的答案所说的那样完全删除与 conda 的 oh-my-posh 集成的人来说,有一种方法可以修复未知的字形。

The extra glyphs used can be obtained by using a patched version of Cascadia Code from Nerd Fonts .使用的额外字形可以通过使用来自Nerd Fonts的 Cascadia 代码的修补版本来获得。 Look for the one called Caskaydia Cove.寻找一个叫做 Caskaydia Cove 的地方。 After downloading, open each font file and install it.下载后,打开每个字体文件并安装。 Then the font can be set in Windows Terminal options (press Ctrl+, ) and replace the default font as below:然后可以在 Windows 终端选项中设置字体(按Ctrl+, )并替换默认字体如下:

"fontFace" : "CaskaydiaCove Nerd Font",

This is how the prompt should look now.就是提示现在的样子。

I was able to fix this by referencing this https://superuser.com/q/1424905/1183235 question.我可以通过参考这个https://superuser.com/q/1424905/1183235问题来解决这个问题。 I listed all my powershell profiles, saw one that initialized conda and removed it.我列出了我所有的 powershell 配置文件,看到一个初始化 conda 并将其删除。 Now it works!现在它起作用了!

To list all powershell profiles:列出所有 powershell 配置文件:

$PROFILE | Format-List -Force

Add添加

$sl.PromptSymbols.VirtualEnvSymbol = '' $sl.PromptSymbols.VirtualEnvSymbol = ''

at the bottom of Paradox's theme file (or current theme's file)在 Paradox 主题文件(或当前主题文件)的底部

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM