Notepad2 Modifications

Introduction

Notepad2 is a free, open-source text editor created by Florian Balmer. I have been a user of Notepad2 for a few years; it is the primary text editor that I use every day. This page was created as a way for me to share some of my Notepad2 resources.

Why Notepad2?

Most editors are either fully-featured but slow or fast but useless, but Notepad2 breaks that mould. Notepad2 has a small footprint and is very fast, even when used on very old machines; the only other text editor that I have used that starts up as fast as Notepad2 is Windows Notepad. Aside from rivaling Windows Notepad for startup speed and responsiveness, Notepad2 also sports a clean, unobtrusive interface free of the clutter that often overwhelms the users of other text editors. Yet, despite its speed and tidy interface, Notepad2 sports a lot of powerful features, such as syntax highlighting, brace matching, tag completion, encoding conversion, code folding (with my custom build; see below), and a variety of other useful tools. Put together, this mix of features, speed, and usability makes Notepad2 the ideal Notepad replacement.

My Notepad2 Patches

The great thing about the open-source nature of Notepad2 is that if there is something that I would like to have changed, I can get the source and build my own custom version. Here are the patches that I use in my custom Notepad2 build:

Updated 21 Jul 2009: Updated for version 4.0.22-beta5. (full changelog)

What these patches contain:

Note: These are source code patches, for people who want to create their own builds. Pre-compiled 32-bit and 64-bit binaries of Notepad2 containing these patches are located at the bottom of this page.

Replacing Windows Notepad with Notepad2

Replacing Windows Notepad with Notepad2 can be a little tricky since notepad.exe is a protected system file, which makes a direct replacement a bit difficult (though not impossible).

There is an easier way to replace Windows Notepad by using the "Image File Execution Options" registry key to trick Windows into running notepad2.exe whenever notepad.exe is run. This same trick is used by the "Replace Task Manager" function in Microsoft's Process Explorer. The benefit to using this method to replace Notepad is that you will not run afoul of Windows File Protection (since you are not actually replacing the executable itself), and you can undo it at any time by simply deleting the registry key. The downside to this method is that it does not work properly with the official Notepad2 build; there are a few minor changes that need to be made to Notepad2 in order for this to work (see my img_exec_replace patch).

In order to use this method of Notepad replacement, you will need to follow these steps:

  1. Obtain a build of Notepad2 that supports this form of Notepad replacement.
  2. Create the following registry key: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe.
  3. Inside the key, create a new string (REG_SZ) value, named "Debugger".
  4. Set the data of this new "Debugger" value to the full path to the Notepad2 executable, followed by the /z switch. For example, "C:\Windows\Notepad2.exe" /z

My Custom Notepad2 Builds

For those of you who would like a custom build of Notepad2 containing my patches, but do not feel comfortable compiling your own code, you can download one of the binary packages below. These are installers that use the registry key method to replace Notepad with Notepad2 (source code for the installer).

For advanced users: To run the installer in quiet (unattended) mode, invoke the installer with the /quiet command-line switch, and to extract the files to the current directory without installing, invoke the installer with the /extract command-line switch. If you do not want to replace Windows Notepad with Notepad2 and/or you want Notepad2 to "leave no trace", you can simply "unzip-and-run" without installing.