无法识别 oh-my-posh 提示中未编码元素的来源
Cannot identify the source of uncoded element in oh-my-posh prompt
我在 Windows 终端中使用 oh-my-posh v3。
如果我在非 git 目录中,我的提示如下所示...
但是,在启用了 git 的目录中,它看起来像这样......
我已将主题的定义导出到 json,如您所见,我找不到任何似乎与提示中的第一个块有关的内容。
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#c386f1",
"foreground": "#ffffff",
"leading_diamond": "",
"style": "diamond",
"trailing_diamond": "",
"type": "session"
},
{
"background": "#ff479c",
"foreground": "#ffffff",
"powerline_symbol": "",
"properties": {
"prefix": " ",
"style": "folder"
},
"style": "powerline",
"type": "path"
},
{
"background": "#fffb38",
"foreground": "#193549",
"powerline_symbol": "",
"properties": {
"display_stash_count": true,
"display_upstream_icon": true
},
"style": "powerline",
"type": "git"
},
{
"background": "#f36943",
"foreground": "#193549",
"powerline_symbol": "",
"properties": {
"battery_icon": "",
"charged_color": "#4caf50",
"charging_color": "#40c4ff",
"color_background": true,
"discharging_color": "#ff5722",
"postfix": " "
},
"style": "powerline",
"type": "battery"
},
{
"background": "#6CA35E",
"foreground": "#ffffff",
"powerline_symbol": "",
"properties": {
"prefix": " "
},
"style": "powerline",
"type": "node"
},
{
"background": "#0077c2",
"foreground": "#ffffff",
"powerline_symbol": "",
"properties": {
"prefix": " ﲵ "
},
"style": "powerline",
"type": "shell"
},
{
"background": "#ffff66",
"foreground": "#193549",
"powerline_symbol": "",
"style": "powerline",
"type": "root"
},
{
"background": "#2e9599",
"foreground": "#ffffff",
"leading_diamond": "",
"properties": {
"always_enabled": true,
"color_background": true,
"display_exit_code": false,
"error_color": "#f1184c",
"prefix": "<transparent></> "
},
"style": "diamond",
"trailing_diamond": "",
"type": "exit"
}
],
"type": "prompt"
}
],
"final_space": true
}
我的 $Profile 看起来像这样...
Import-Module posh-git
Import-Module oh-my-posh
Import-Module -Name Terminal-Icons
Set-PoshPrompt -Theme jandedobbeleer
谁能告诉我这是从哪里来的?
原来答案很简单;从我的 $profile
中删除 Import-Module posh-git
我在 Windows 终端中使用 oh-my-posh v3。
如果我在非 git 目录中,我的提示如下所示...
但是,在启用了 git 的目录中,它看起来像这样......
我已将主题的定义导出到 json,如您所见,我找不到任何似乎与提示中的第一个块有关的内容。
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#c386f1",
"foreground": "#ffffff",
"leading_diamond": "",
"style": "diamond",
"trailing_diamond": "",
"type": "session"
},
{
"background": "#ff479c",
"foreground": "#ffffff",
"powerline_symbol": "",
"properties": {
"prefix": " ",
"style": "folder"
},
"style": "powerline",
"type": "path"
},
{
"background": "#fffb38",
"foreground": "#193549",
"powerline_symbol": "",
"properties": {
"display_stash_count": true,
"display_upstream_icon": true
},
"style": "powerline",
"type": "git"
},
{
"background": "#f36943",
"foreground": "#193549",
"powerline_symbol": "",
"properties": {
"battery_icon": "",
"charged_color": "#4caf50",
"charging_color": "#40c4ff",
"color_background": true,
"discharging_color": "#ff5722",
"postfix": " "
},
"style": "powerline",
"type": "battery"
},
{
"background": "#6CA35E",
"foreground": "#ffffff",
"powerline_symbol": "",
"properties": {
"prefix": " "
},
"style": "powerline",
"type": "node"
},
{
"background": "#0077c2",
"foreground": "#ffffff",
"powerline_symbol": "",
"properties": {
"prefix": " ﲵ "
},
"style": "powerline",
"type": "shell"
},
{
"background": "#ffff66",
"foreground": "#193549",
"powerline_symbol": "",
"style": "powerline",
"type": "root"
},
{
"background": "#2e9599",
"foreground": "#ffffff",
"leading_diamond": "",
"properties": {
"always_enabled": true,
"color_background": true,
"display_exit_code": false,
"error_color": "#f1184c",
"prefix": "<transparent></> "
},
"style": "diamond",
"trailing_diamond": "",
"type": "exit"
}
],
"type": "prompt"
}
],
"final_space": true
}
我的 $Profile 看起来像这样...
Import-Module posh-git
Import-Module oh-my-posh
Import-Module -Name Terminal-Icons
Set-PoshPrompt -Theme jandedobbeleer
谁能告诉我这是从哪里来的?
原来答案很简单;从我的 $profile
中删除Import-Module posh-git