Notepad++ is the one of the most, if not the most, popular text editor for Windows. It’s fast, powerful, and comes with support for dozens of different file types. If you are using it as your default text editor, here’s a little tip for copying codes with syntax highlighting from the program to any external program.
When you open a supported file format in Notepad++, it performs syntax highlighting where it formats the text with various colors to make reading easier.
However, when you save the file or copy text from it to an external program, all of the syntax highlighting and formatting is lost, and the text will take on formatting of the program you’re pasting into. This shouldn’t be surprising as the program is basically a plain-text editor. The syntax highlighting you see is just a visual enhancement. Although, there is a way to retain this formatting, i.e. if you have NppExport plugin installed. Latest builds of Notepad++ ships with this plugin. If you don’t have NppExport installed, you can download it through the inbuilt plugin manager.
When you have it ready, highlight the code that you want to copy, then go to Plugins (on the menu bar) > Select NppExport > Copy all formats to clipboard. Now when you paste the code into a program that supports rich text formatting, for example Microsoft Word or Evernote, all of the formatting should be retained.
Within NppExport menu, you’ll also find other exporting and copying options. To save the code with all the formatting preserved to an external file, choose Export to RTF or HTML. The Copy HTML to clipboard option allows you to quickly share a formatted code snippet on your blog or website.
Hope this tip helped.