windows terminal中配置on-my-posh,conda虚拟环境提示不生效

发布时间 2023-07-10 22:32:09作者: fanyfan

遇到了oh-my-posh的conda虚拟环境提示无法生效的问题。
实际不是不生效,只是在~文件夹下面看不到。进入到其他任何文件都能看到虚拟环境提示。

原因是:on-my-posh的配置的python segment的properties中有一个项目是"home_enabled", 默认值是false。

很早以前踩过这个坑,但重装系统又花了很长时间解决这个问题。网上查到的有用资料很少,故记下来。

目前用的python的segment的配置

{
	"type": "python",
	"style": "powerline",
	"properties": {
		"display_mode": "environment",
		"fetch_virtual_env": true,
		"home_enabled": true
	},
	"powerline_symbol": "",
	"foreground": "#100e23",
	"background": "#906cff",
	"template": "  {{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}{{ .Venv }} {{ end }}{{ .Full }}{{ end }} "
},