在cygwin中使用Notepad ++ for git

scp*_*ntm 7 git cygwin notepad++

这是这个问题的延伸

如何在msysgit中使用Notepad ++(或其他)?

我已经为我的shell脚本完成了所有可以想到的组合.当我有我的cygwin控制台(我使用mintty,如果它重要)我可以打字

npp {file}
Run Code Online (Sandbox Code Playgroud)

并正确打开文件.但是当我做一个

git rebase -i HEAD~5
Run Code Online (Sandbox Code Playgroud)

npp打开一个空白的新文档,而不是用于控制rebase的交互式文件.知道为什么会这样吗?

git --version
git version 1.7.9

Windows 7机器和NPP 5.9.8上最新版本的cygwin

另外,这是我的包装脚本

#!/bin/sh
"C:/Program Files (x86)/Notepad++/notepad++.exe" -multiInst -notabbar \
  -nosession -noPlugin "$*"
Run Code Online (Sandbox Code Playgroud)

scp*_*ntm 15

关于我的cygwin路径问题我是正确的.我改变了我的shell包装器

#!/bin/sh
'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar \
  -nosession -noPlugin "$(cygpath -w "$*")"
Run Code Online (Sandbox Code Playgroud)

它工作得很好.


Ate*_*nus 5

这是没有包装器脚本完整解决方案.

这些行假设您使用的是64位版本的Windows.

从命令提示符(Cygwin)运行以下命令:

git config --global core.editor \
  "'$(cygpath -u "C:\Program Files (x86)\Notepad++\notepad++.exe")' \
  -multiInst -notabbar -nosession -noPlugin"
Run Code Online (Sandbox Code Playgroud)

这是一个示例,说明命令后.gitconfig的外观如何:

[core]
    excludesfile = /home/Aternus/.gitignore_global
    autocrlf = input
    safecrlf = true
    editor = '/cygdrive/c/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin
Run Code Online (Sandbox Code Playgroud)

  • 这可能只适用于Windows版本的Git,而不是Cygwin,因为Cygwin的Git会使用Cygwin的文件路径执行Notepad ++:`notepad ++.exe/home/user/repository/file.extension`.我确定Windows Notepad ++不会找到这样的文件.即使你在Cygwin的目录之外有你的回购,它也会是这样的:`notepad ++.exe/cygdrive/d/repository/file.extension`. (3认同)