git - 使用 Programmer's Notepad 2 作为 git 的编辑器

标签 git programmers-notepad

我看过关于使用 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/

相关文章:

git - 在 git scm 中撤消 "git checkout HEAD foo.c"

android - 奇怪的 xml 错误 : Incorrect line ending

swift - Steam 部署 -> 错误 : Repository not found

git - 我们如何通过git在windows上使用linux命令?

git - "at"@ sign/symbol/character 在 Git 中是什么意思?

compiler-construction - 程序员的记事本无法捕获 Make 输出?

程序员记事本的 Haml 和 Sass?