从 Git bash 调用 Notepad++

To invoke Notepad++ from Git bash

尝试从 Git Bash 启动 Notepad++,所以我做到了

git config --global core.editor "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

然后

> echo 'alias notepad++="C:/Program Files
> (x86)/Notepad++/notepad++.exe"' >> ~/.bashrc

此后我重新启动 GitBash 并尝试 运行 notepad++,但我收到警告和错误消息..

WARNING: Found ~/.bashrc but no ~/.bash_profile, ~/.bash_login or ~/.profile.

This looks like an incorrect setup. A ~/.bash_profile that loads ~/.bashrc will be created for you.

如果我 运行 记事本++,它得到

bash: syntax error near unexpected token `('

描述

OS: Windows 7 x64

转到您的 C:\Users\<your username>\

找到.gitconfig文件并用记事本或任何你喜欢的文本编辑器打开它;在文件末尾添加以下行

例子

[core]  
    editor = 'F:/Software/Notepad++/Notepad++Portable.exe'

你也可以试试这个

git config --global core.editor "'C:/Program Files/TextPad 5/TextPad.exe' -m"

显然,将路径替换为文本编辑器的路径,它应该可以工作。

尝试使用“\”或“\\”

git config --global core.editor "'C:/Program Files \\(x86\\)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

刚刚尝试将 Notepad++ 文件夹放在不同的驱动器中并使用 shell 命令 别名记事本++='d:/Notepad++/notepad++.exe'
这有效。

这对我有用,

alias notepad="/c/Program\ Files\ \(x86\)/Notepad++/notepad++.exe"

来源:http://cruisebogedin.com/2014/01/make-notepad-default-editor-in-git/