Notepad++ : Custom Syntax Highlighting for .txt files

No, it can't. You can choose it manually or use special file type extensions which you then associate with Notepad++ and tell it to highlight the files as the appropriate language.

For example, use .txtsql files for SQL, .txtcpp files for C++ and so on.


I'd suggest giving them the proper file extensions, then import something like this into your registry:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\NotepadPlusPlus]

[HKEY_CLASSES_ROOT\*\shell\NotepadPlusPlus\command]
@="C:\\path\\to\\notepad++.exe \"%1\""

Then you can open your files in NP++ with a quick right-click, and NP++ will be able to auto-detect the right language based on the file extension.


Manual selection is a much simpler way. Store all the files in .txt format (irrespective of java or C or C++). Open the file in Notepad++ and select the corresponding language in the Menu. e.g. Language --> Java.