我看过关于使用 notepad++ 和其他 git 编辑器的帖子,但没有看到关于使用 PN2 的帖子。
我尝试了以下变体,但它们似乎都不起作用:
git config --global core.editor "'C:\Program Files (x86)\Programmer's Notepad\pn.exe -allowmulti' -w"
我只是得到如下错误(这是在“git commit --amend”之后):
'C:\Program Files (x86)\Programmer's Notepad\pn.exe -allowmulti' -w: -c: line 0:
unexpected EOF while looking for matching `''
'C:\Program Files (x86)\Programmer's Notepad\pn.exe -allowmulti' -w: -c: line 1:
syntax error: unexpected end of file
error: There was a problem with the editor ''C:\Program Files (x86)\Programmer's
Notepad\pn.exe -allowmulti' -w'.
Please supply the message using either -m or -F option.
是否有可能让它发挥作用?
最佳答案
编辑器由 git 使用 bash 脚本启动。所以你应该确保你的引用是针对 bash shell 的。您使用了单引号,但目录名称中嵌入了单引号。您可能还应该使用正斜杠并使其统一。参见 this answer对于使用 Notepad++ 的示例。对于您的情况,我认为以下内容应该没问题:
git config --global core.editor "\"C:/Program Files (x86)/Programmer's Notepad/pn.exe\" -allowmulti -w"
关于git - 使用 Programmer's Notepad 2 作为 git 的编辑器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13901180/