将 VSCode 设置为我的 Mac M1 的 Git 默认编辑器

问题描述

最近得到了一个 M1,我正试图将我的头围绕在认的 shell zsh 上。 我尝试的第一件事是使用 bash:

git config --global core.editor "code -w"

这条线过去曾经像魅力一样有效,但现在不行了,现在我一遍又一遍地得到这个错误

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 中安装:Install 'code' in command PATH 但它显然在 bash 中安装所有依赖项而不是 zsh .

我到处搜索如何在新的 M1 模型上配置 vsc,但我没有找到任何与之相关的内容

如果有人能阐明如何做到这一点,我们将不胜感激。将 VSC 作为我的认文本编辑器也很好,不仅适用于 Git,而且适用于所有内容

解决方法

如您所见,这是有效的:

 git config --global core.editor "/usr/local/bin/code"

但您也可以考虑安装(几天后)VSCode 1.54(2021 年 2 月),with official M1 support

Screenshot of website showing the default download for macOS

(目前仍然是 insider build