Git: Add Notepad as an option in Git installer

Created on 21 Jan 2018  路  16Comments  路  Source: git-for-windows/git

git version 2.16.0.windows.2

I have been using Notepad (not Notepad++) as default editor for git for a long time (set up by git config --system core.editor notepad).

Since Git 2.15.1, the Git installer adds an option to configure default editor at installation time. Since then, I have to re-run git config every time I update Git. Please add Notepad as an option in the installer.

enhancement installer up for grabs

Most helpful comment

@boogisha I like the idea of adding "Leave current editor" to the installer.

All 16 comments

Notepad is not ideal because it does not support \n. It only supports \r\n

Which is why there is a notepad wrapper script to convert \n to \r\n and vice versa. Notice that the command is git config --system core.editor notepad, not git config --system core.editor notepad.exe.

Git works with Notepad for a very long time already.

I've been using Notepad++ as default editor for a long time myself (so not Notepad, but it doesn't matter for the point), before installer supported it, but set up by git config --global core.editor ... (notice "--global" option, ending up in user home folder), so installer option affecting "--system" doesn't make a difference (and no need to reconfigure each time).

Now, if you have many users, I can imagine how setting "--system" only would be more convenient, but unrelated to if Notepad is to be added as an installer option or not, it might be sensible to teach installer a "Leave current editor" option, too (or something, better phrased), so there's an escape hatch for people using other editors inside "--system" as well, even if those are not (yet) supported by the installer.

@boogisha I like the idea of adding "Leave current editor" to the installer.

Is some one up for it? (i.e. adding the option to 'do nothing, keep existing editor settings' or whatever is felt best).

PR welcome.

I use Notepad2 which replaces Windows's notepad.exe
I don't want git installer to change my editor settings when upgrading

If someone with some knowledge of Inno Setup want to do it, that here it seems: https://github.com/git-for-windows/build-extra/blob/9ab82457606cc3f79e3b1a8088d2e61c79bfe1c7/installer/install.iss#L307

And if someone could rename the issue (I nearly create an issue myself)

The previous step explicitly states

Associate .git* configuration files with the default text editor

Why does this second question about picking the editor even exist?

Not to mention it consist only couple of editors out of 1000s available, and none of those exists in my machine

Why does this second question about picking the editor even exist?

Because you may want to specify which editor you want to choose as your default?

Not to mention it consist only couple of editors out of 1000s available, and none of those exists in my machine

That's because you did not contribute a patch to detect any of the editors that exist on your machine.

Sorry, I didn't mean to be rude. I really appreciate the work being done here and in open-source community in general. I try to contribute as much as I can.

I just wanted to know what is the rationale behind current design, not to propose something totally off.

Because you may want to specify which editor _you_ want to choose as your default?

The way I understood "the default text" editor is the editor configured in my system to open text (.txt) files. Therefore, the editor I've already chosen before even starting the installer.

I'm not a native English speaker, so that may be something I lost in translation, but current behavior is more like "Associate .git* configuration files with the given text editor" to me.

Regardless of above. Given the growing number of editors available, it could be cumbersome to maintain somewhat complete, closed list of ones to pick. Wouldn't it be easier to let the user choose either:

  • Do nothing, keep existing editor settings,
  • Provide a path to an editor, which someone would like to associate .git* files with,
  • Pick current application configured in the system to open text files, (what is "the default text editor to me"),
  • Pick editor from the short list (if there is a need to keep such list of recommended programs).

That's because you did not contribute a patch...

Is that the repo to start with? https://github.com/git-for-windows/build-extra/tree/master/installer

The way I understood "the default text" editor is the editor configured in my system to open text (.txt) files.

Git has special requirements. For example, the commit message cannot be assumed to have CR/LF line endings. Therefore, Git cannot blindly reuse the default editor for .txt files (most of Git's files that are opened by the default editor are not .txt files to begin with: COMMIT_EDITMSG, config, MERGE_MSG, git-rebase-todo, etc).

Provide a path to an editor, which someone would like to associate .git* files with,

Please have a look at the existing options: https://github.com/git-for-windows/build-extra/blob/1f1d602268769403382319dd7fbc946bf2e9981b/installer/install.iss#L2093-L2106

It is hardly as trivial as simply calling an executable, as Git expects the command to return only when, and as soon as, the user finished editing. For Visual Studio Code, for example, the --wait option needs to be passed. And for Notepad++, even -multiInst -notabbar -nosession -noPlugin.

Is that the repo to start with? https://github.com/git-for-windows/build-extra/tree/master/installer

Technically, this is a directory inside a repository. And yes, this is the one, better even would be the correct file: https://github.com/git-for-windows/build-extra/blob/master/installer/install.iss

And this is the description how you can test your changes: https://github.com/git-for-windows/git/wiki/Making-an-installer

Notepad is not ideal because it does not support \n. It only supports \r\n

That has now changed! I know it's hard to believe. Currently only Insiders builds though.

Currently only Insiders builds though.

Also currently Windows 10 only. And that restriction is probably going to stay. Git for Windows still supports older Windows versions, so there might be a check for the OS version needed on that option on the installer.

If not as an option to the dropdown, would you at least consider making sure that the option "Select an editor" actually _works_ with notepad? Currently, the installer invokes notepad.exe as a windowless process, making it impossible to perform the necessary steps to set it as default (or continue at all, for that matter).

I think this thread quite clearly shows that we're open to an installer option, it just seems like no one actually cares enough about using notepad as their Git editor to implement it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vocaviking picture vocaviking  路  5Comments

daxelrod picture daxelrod  路  4Comments

jesterKing picture jesterKing  路  3Comments

michaelblyons picture michaelblyons  路  5Comments

Unknow0059 picture Unknow0059  路  3Comments