Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the current version of Notepad++ opening .sql files results in Notepad applying SQL syntax highlighting to it. I'd like Notepad++ to do the same for other extensions as well, is there some setting where I can define this?

share|improve this question
It doesn't already? It should do so by default. – D'Arvit Sep 14 '09 at 10:11
It does for .sql files, not for other files – Sathya Sep 14 '09 at 10:12
I wish Notepad++ just remembered the language selected from the menu for each file, or offered to add your extension to that language's style configurator on the second time you associated the extension with a language. – Matthew Lock Dec 3 '14 at 3:35
up vote 267 down vote accepted

When you open a file in notepad++ it will attempt to load syntax highlighting for the contents based on file extension.

If you use custom extension for one of the existing languages you can add the custom extension in Settings -> Styler Configurator. Select language and add the extension in "User extension" edit box. To add multiple extensions separate them using Space.

You then need to re-open your file to see the syntax highlighting applied.

You can also change syntax highlighting style by selecting a different language from language menu.

share|improve this answer
I have tried this, but it assigns only to 1 extension, I want to assign multiple extensions. – Sathya Sep 14 '09 at 11:39
you can add multiple extensions by separating them with space, added that into my post – T. Kaltnekar Sep 14 '09 at 12:23
Thank you, it works fine! – Sathya Sep 14 '09 at 13:58
Thanks! Would have never figured it out on my own:) – axk Nov 25 '11 at 11:21
Note that making this change will not effect files that are currently open in Notepad++. Also, closing and re-opening Notepad++ still will not effect files that remain open between sessions. The individual files must be closed and re-opened for the effect to be seen. – mwolfe02 May 10 '12 at 16:12

Find the langs.xml file (usually under C:\Users[username]\AppData\Roaming\Notepad++), open it with Notepad++, find the line that begins with <Language name="sql" ext="sql" and add the extensions you want in the ext field, separating them with a space.

To do this for a user-defined language, look instead for userDefineLang.xml and edit ext="".

share|improve this answer
This approach works fine as well, but T. Kaltnekar's approach is a bit more user friendly, thanks! – Sathya Sep 14 '09 at 13:59
It's the only way I knew how :). – alex Sep 14 '09 at 14:01
Nice, I prefer this approach, I've got a lot of custom extensions and its easier to copy and past them in this way. – James Feb 28 '11 at 19:27
This method worked for me. I don't understand why adding the extension with the GUI does not work. "C:\users(user)\appdata\roaming\notepad++\langs.xml" – jimueller Jul 18 '12 at 16:42
I do not have Notepadd++ installed, just unzipped, so the lang.xml file is in application directory ;-) – Betlista Nov 26 '15 at 14:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .