1

我正在使用新的windows 终端
我刚刚安装了powershell v7.0.2starship以使其更好。

我想编辑starship配置,所以我运行了这个命令:

> starship.exe config
----------------------
Error: editor "vi" was not found. Did you set your $EDITOR or $VISUAL environment variables correctly?
Full error: Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }

所以我继续编辑我$PROFILE的设置visual studio code为默认编辑器(code在路径中):

> code $PROFILE
---------------
$ENV:EDITOR = "code"
$ENV:VISUAL = "code"

现在我得到了同样的错误,但是用code而不是vi

> starship.exe config
----------------------
Error: editor "code" was not found. Did you set your $EDITOR or $VISUAL environment variables correctly?
Full error: Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }

我最终运行的原因starship config是因为在创建$HOME\.starship\starship.toml配置文件后starship忽略它,尽管我已经在我的配置文件中设置了路径:

> code $PROFILE
---------------
$ENV:STARSHIP_CONFIG = "$HOME\.starship"

所以我跑去starhip config看看它期望的路径是什么config file


我也尝试将完整路径设置为visual studio codein $EDITOR,但没有帮助。

4

3 回答 3

1

我遇到了完全相同的问题,并设法通过将 $EDITOR 变量设置为编辑器的绝对路径来解决它,因此对于 Visual Studio Code,将其添加到您的 $PROFILE 中:

$ENV:EDITOR = "C:\Program Files\Microsoft VS Code\Code.exe"
于 2020-08-22T20:13:45.590 回答
0

我很惊讶代码不在您的路径中:

$env:path += ";C:\Users\$username\AppData\Local\Programs\Microsoft VS Code\bin"
于 2020-07-11T23:06:53.530 回答
0

你的意思是,打开ps1的默认程序?如果是这样,它是一个注册表项,HKLM 并找到扩展名......

于 2020-07-11T22:35:55.650 回答