This content is part of the Essential Guide: Master Git basics and branch into DVCS

Essential Guide

Browse Sections
News Stay informed about the latest enterprise technology news and product updates.

How to set Notepad++ as the Git editor instead of Vim


Make Notepad Git’s editor

For the most part, developers who are new to the Git tool don’t have too much of a problem mastering the five basic git commands every beginner should learn. But one speed-bump that does tend to trip up new users is the fact that the Git editor defaults to Vim. For those with a Windows background, figuring out how to add a comment, save the entry and then exit the Vim Git editor can be frustrating, if not a little scary.

Changing away from Vim as the default Git text editor

Notepad++ is often preferred over Vim as the default Git editor for commit text.

Changing the Git editor to Notepad++

Fortunately, it’s not that difficult to change the default Git editor to a text editor of your choosing, be it Notepad, EditPad or my personal favorite, Notepad++.  All you have to do is issue a git config command and specify the core editor of your choice. The config command to change the default Git editor to Notepad++ is as follows:

gitbeginner@devops MINGW32 /c/ change git/ default editor
$ git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

It should be noted that I issued this command on a Windows 32-bit machine. Obviously, on an x64 machine, Notepad++ would be found under the Program Files (x86) directory. The bottom line is that when you run this command, make sure you provide the correct location of your text editor of choice.

This change to the default Git text editor was specified to take place at the global Git scope, so the change can be inspected by opening the .gitconfig file found under the user’s home directory. Upon inspection, you will note that a new core heading has been added to the Git configuration file and the editor property has been set to Notepad++:

Making Notepad++ the default Git text editor

How to change the default Git editor to Notepad++ in the global .gitconfig file



  editor = 'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin

Using Notepad++ as the Git editor

As far as the switches after the listing of the executable, those are all Notepad++ specific and have nothing to do with Git. These popular switches ensure that a new Notepad window is displayed, rather than just adding a new tab to an existing Notepad++ instance that might already be running. The switches also ensure that no plugins are loaded into Notepad++, which might make loading Notepad++ faster while avoiding any problems with misconfigured plugins. The -nosession switch tells Notepad++ not to bring up any files from previous sessions, ensuring that the current commit is the only thing the text editor displays.

The next time you issue a git commit without specifying a commit message, Notepad++ will pop up. Just add a message, click save and close the window. The message you typed in will then become part of the history of the git branch upon which you are working.

Notepad++ and Git Installed together

It’s worth noting that recent editions of the DVCS tool now have an option during the install to configure Notepad Plus Plus as Git’s default editor. The following video demonstrates the process of configuring Git and Notepad++ during the initial install. Of course, the end result is the same, with the following entry being made to the Git config file:

editor = \"C:\\\\Program Files\\\\Notepad++\\\\notepad++.exe\" -multiInst -notabbar -nosession -noPlugin

App Architecture
Software Quality
Cloud Computing