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

use*_*679 2 git programmers-notepad

我见过有关使用notepad ++和其他编辑器的帖子,但没有关于使用PN2的帖子.

我尝试过以下各种变体,但它们似乎都没有效果:

git config --global core.editor "'C:\Program Files (x86)\Programmer's Notepad\pn.exe -allowmulti' -w"
Run Code Online (Sandbox Code Playgroud)

我只是得到如下错误(这是在"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.
Run Code Online (Sandbox Code Playgroud)

有可能让这个工作吗?

pat*_*yts 5

该编辑器由git使用bash脚本启动.所以你应该确保你的引用是针对bash shell的.您使用单引号但目录名中有嵌入的单引号.您可能也应该使用正斜杠并使其单一.有关使用Notepad ++的示例,请参阅此答案.在你的情况下,我认为以下应该是好的:

git config --global core.editor "\"C:/Program Files (x86)/Programmer's Notepad/pn.exe\" -allowmulti -w"
Run Code Online (Sandbox Code Playgroud)

  • 请注意,最新版本的Programmer's Notepad需要两个破折号才能允许多个; 例如--allowmulti (2认同)