Notepad copy format syntax

I use the awesome Notepad++ text editor all of the time, and it’s an excellent tool for making quick edits to code or other specially formatted files such as XML. For dozens of different file types it is able to perform syntax highlighting where it formats the text with various colors to make reading the files easier. You should keep in mind that Notepad++ is really a plain-text editor that doesn’t let you bold or format text in any special ways though, and the formatting you see is not actually stored when you save the files.

With all of that taken into account it should come as no surprise that when you try to copy the text out of Notepad++ it likely won’t look the same. All of the syntax highlighting will be lost, and the text will take on similar formatting to the document you’re pasting the code into. There is, however, a way you can retain the formatting, which may be what you’re looking for if you are just sending a snippet over to some through email to have them review. After all, if it makes it easier for you to read it will likely also make it easier for someone else to read.

Assuming you’ve installed Notepad++ with the default installer (not the minimalist version) and didn’t remove any of the plugins you should have everything you need to do this already. Just click on the Plugins entry on the menu bar, and select NppExport > Copy all formats to clipboard. Now when you go to paste the text into something that supports rich text all of the formatting should be retained. Within that menu you can also export the code to a rich text file (RTF) or to an HTML file so that it can easily be displayed in a browser. The Copy HTML to clipboard option would be useful if you wanted to quickly share a formatted version of the text on a blog or website since you could then just paste it into your blog editor and be ready to go.

This probably isn’t something most of you will use very often, but I personally use it for saving snippets of code in Evernote so that the next time I need to reference it the code is easier to read.

There Are 4 Comments

  1. As an existing Notepad++ user this is a great little tip. Thanks.

  2. This doesn’t work! I use the latest version of notepad++.

Leave Your Comment


Message is the only required field.
Emails are not published.