最近得到了一个 M1,我正在尝试使用默认的 shell zsh
。
我尝试的第一件事是 bash
的常用行:
git config --global core.editor "code -w"
这条线过去曾经像 charm 一样工作,但现在不行了,现在我一遍又一遍地遇到这个错误。
hint: Waiting for your editor to close the file... code -w: code: command not found
error: There was a problem with the editor 'code -w'.
然后我尝试将行 export EDITOR="code -w"
添加到 ~/.zshrc
甚至按照步骤从 shell 命令在 vscode 中安装: 在命令 PATH 中安装“代码”
,但显然它在 bash 中安装所有依赖项而不是 zsh。
我到处搜索如何在新的 M1 型号上配置 vsc,但没有找到任何相关内容。
如果有人能阐明如何做到这一点,我们将不胜感激。将 VSC 作为我一般的默认文本编辑器也很好,不仅适用于 Git,适用于所有内容。
最佳答案
如果您使用的是 Visual Studio Code - Insiders,您可以尝试以下 git 命令
git config --global core.editor 'code-insiders --wait'
或
git config --global core.editor 'code-insiders -w'
如果在运行上述 git 命令后遇到类似的错误,请尝试输入 shell
过滤一些 shell 命令,如 Install 'code-insiders' command in PATH
或 Uninstall 'code-insiders' command from PATH
添加或删除 code-insiders
通过输入 ctrl + shift + p
打开命令盘后从 PATH (或 command + shift + p
)
顺便说一句,在安装 GitLens 扩展后,将 VSCode 设置为 Git 默认编辑器是一个更好的选择。
关于git - 将 VSCode 设置为我的 Mac M1 的默认 Git 编辑器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65572819/