【问题标题】:Integrating MINGW64 into Visual Studio Code [duplicate]将 MINGW64 集成到 Visual Studio Code [重复]
【发布时间】:2021-11-19 06:40:59
【问题描述】:

https://code.visualstudio.com/docs/editor/integrated-terminal 开始,我已经能够将 shell 放在 shell 选项中,但是当我选择它时,它会弹出一个与 VSCode 终端分开的新窗口。我该如何解决这个问题?

这是我在settings.json中所做的:

"terminal.integrated.profiles.windows": {
...
"MINGW64": {
            "path": "C:\\msys64\\mingw64.exe"
        }
}

我也有问题git。我将 git 安装为 msys2 的包。我已经设置了所有基本的git config 参数。

但是当我尝试git config --global -e 时,它会报错:

hint: Waiting for your editor to close the file... code --wait: line 1: code: command not found error: There was a problem with the editor 'code --wait'.

所以我在 cmd 中进行了尝试,它成功了。 where code 也只能在 cmd 中工作。

所以我想知道会是什么问题。会不会和PATH 有关?还是与上述问题有关?

【问题讨论】:

  • @HolyBlackCat 这种方法还能用吗?我之前已经查看过该帖子但没有使用它,因为它使用了terminal.integrated.shell.windows 这是过时的版本吗?

标签: git terminal vscode-settings mingw-w64 msys2


【解决方案1】:

所以我在 cmd 中进行了尝试,它成功了。其中代码也只能在 cmd 中工作。

除了实际执行的是code.cmd
在 bash 会话中,检查 $PATH 是否引用了与 CMD 中相同的文件夹。

考虑也直接使用Git For Windows:你可以添加它的git bash to VSCode

在.bashrc中:

export PATH=$PATH:"/C/Users/User1/AppData/Local/Programs/Microsoft VS Code/bin"

【讨论】:

  • 你的意思是 gitcore.editorPATH 对于 bashcmd 应该是相同的?
  • @Zernoxi 是的,但在 bash 会话中使用不同的形式:/C/...
  • [core] editor = code --wait 两个会话都引用同一个 .gitconfig 文件。不应该是这样吗? @VonC​​pan>
  • @Zernoxi ~/.gitconfig 是一回事。如果在 bash 会话中没有正确的 $PATH,它将无法工作。
  • 您能解释一下如何设置吗? @VonC​​pan>
猜你喜欢
  • 2021-09-11
  • 2020-08-15
  • 2019-08-29
  • 2016-02-22
  • 1970-01-01
  • 1970-01-01
  • 2016-12-08
  • 2021-05-19
  • 1970-01-01
相关资源
最近更新 更多